Artifacts #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
workflow_dispatch: | |
name: Artifacts | |
env: | |
RELEASE_BIN: dovi_meta | |
RELEASE_DIR: artifacts | |
WINDOWS_TARGET: x86_64-pc-windows-msvc | |
MACOS_X86_TARGET: x86_64-apple-darwin | |
MACOS_ARM_TARGET: aarch64-apple-darwin | |
LINUX_TARGET: x86_64-unknown-linux-musl | |
jobs: | |
linux-binary: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-release-env | |
- name: Install musl-tools | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install musl-tools -y | |
- name: Build | |
run: | | |
rustup target add ${{ env.LINUX_TARGET }} | |
cargo build --release --target ${{ env.LINUX_TARGET }} | |
- name: Create tarball and checksum | |
run: | | |
ARCHIVE_FILE=${{ env.RELEASE_DIR }}/${{ env.ARCHIVE_PREFIX }}-${{ env.LINUX_TARGET }}.tar.gz | |
strip ./target/${{ env.LINUX_TARGET }}/release/${{ env.RELEASE_BIN }} | |
mv ./target/${{ env.LINUX_TARGET }}/release/${{ env.RELEASE_BIN }} ./${{ env.RELEASE_BIN }} | |
tar -cvzf ./${ARCHIVE_FILE} ./${{ env.RELEASE_BIN }} | |
python -c "import hashlib; import pathlib; print(hashlib.sha256(pathlib.Path('${ARCHIVE_FILE}').read_bytes()).hexdigest())" > ${ARCHIVE_FILE}.sha256 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Linux artifacts | |
path: ./${{ env.RELEASE_DIR }}/* | |
windows-binary: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-release-env | |
- name: Install cargo-c | |
run: | | |
$LINK = "https://github.com/lu-zero/cargo-c/releases/latest/download" | |
$CARGO_C_FILE = "cargo-c-windows-msvc" | |
curl -LO "$LINK/$CARGO_C_FILE.zip" | |
7z e -y "$CARGO_C_FILE.zip" -o"${env:USERPROFILE}\.cargo\bin" | |
- name: Build | |
run: cargo build --release | |
- name: Create zipfile | |
shell: bash | |
run: | | |
ARCHIVE_FILE=${{ env.RELEASE_DIR }}/${{ env.ARCHIVE_PREFIX }}-${{ env.WINDOWS_TARGET }}.zip | |
mv ./target/release/${{ env.RELEASE_BIN }}.exe ./${{ env.RELEASE_BIN }}.exe | |
7z a ./${ARCHIVE_FILE} ./${{ env.RELEASE_BIN }}.exe | |
python -c "import hashlib; import pathlib; print(hashlib.sha256(pathlib.Path('${ARCHIVE_FILE}').read_bytes()).hexdigest())" > ${ARCHIVE_FILE}.sha256 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Windows artifacts | |
path: ./${{ env.RELEASE_DIR }}/* | |
macos-binary: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-release-env | |
- name: Build | |
run: | | |
rustup target add ${{ env.MACOS_X86_TARGET }} | |
cargo build --release | |
cargo build --release --target ${{ env.MACOS_X86_TARGET }} | |
- name: Create universal macOS binary | |
run: | | |
strip ./target/release/${{ env.RELEASE_BIN }} | |
strip ./target/${{ env.MACOS_X86_TARGET }}/release/${{ env.RELEASE_BIN }} | |
lipo -create \ | |
./target/${{ env.MACOS_X86_TARGET }}/release/${{ env.RELEASE_BIN }} \ | |
./target/release/${{ env.RELEASE_BIN }} \ | |
-output ./${{ env.RELEASE_BIN }} | |
- name: Create zipfile | |
run: | | |
ARCHIVE_FILE=${{ env.RELEASE_DIR }}/${{ env.ARCHIVE_PREFIX }}-universal-macOS.zip | |
zip -9 ./${ARCHIVE_FILE} ./${{ env.RELEASE_BIN }} | |
python -c "import hashlib; import pathlib; print(hashlib.sha256(pathlib.Path('${ARCHIVE_FILE}').read_bytes()).hexdigest())" > ${ARCHIVE_FILE}.sha256 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macOS artifacts | |
path: ./${{ env.RELEASE_DIR }}/* | |
create-release: | |
needs: [linux-binary, windows-binary, macos-binary] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Create a draft release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.RELEASE_PKG_VERSION }} | |
draft: true | |
files: | | |
Linux artifacts/* | |
Windows artifacts/* | |
macOS artifacts/* |