Skip to content

Build Release Binaries #57

Build Release Binaries

Build Release Binaries #57

Workflow file for this run

# Based on typst's release action:
# https://github.com/typst/typst/blob/main/.github/workflows/release.yml
name: Build Release Binaries
on:
workflow_dispatch:
release:
types: [published]
jobs:
build-release:
name: release ${{ matrix.target }}
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-22.04
cross: true
- target: aarch64-unknown-linux-musl
os: ubuntu-22.04
cross: true
- target: armv7-unknown-linux-musleabi
os: ubuntu-22.04
cross: true
- target: riscv64gc-unknown-linux-gnu
os: ubuntu-22.04
cross: true
- target: x86_64-apple-darwin
os: macos-latest
cross: false
- target: aarch64-apple-darwin
os: macos-latest
cross: false
- target: x86_64-pc-windows-msvc
os: windows-latest
cross: false
- target: aarch64-pc-windows-msvc
os: windows-latest
cross: false
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Install Cross
if: ${{ matrix.cross }}
run:
cargo install cross --git https://github.com/cross-rs/cross.git
- name: Run Cross
if: ${{ matrix.cross }}
run:
cross build -p canvas_syncer --release --target ${{ matrix.target }} -v
- name: Run Cargo
if: ${{ !matrix.cross }}
run: cargo build -p canvas_syncer --release --target ${{ matrix.target }}
- name: create artifact directory
shell: bash
run: |
directory=canvas_syncer-${{ matrix.target }}
mkdir $directory
cp README LICENSE $directory
ls target
ls target/${{ matrix.target }}
ls target/${{ matrix.target }}/release
if [ -f target/${{ matrix.target }}/release/canvas_syncer.exe ]; then
cp target/${{ matrix.target }}/release/canvas_syncer.exe $directory
7z a -r $directory.zip $directory
else
cp target/${{ matrix.target }}/release/cnavas_syncer $directory
tar cJf $directory.tar.xz $directory
fi
- uses: actions/upload-artifact@v4
if: github.event_name == 'workflow_dispatch'
with:
name: canvas_syncer-${{ matrix.target }}
path: "canvas_syncer-${{ matrix.target }}.*"
retention-days: 3
- uses: ncipollo/release-action@v1.14.0
if: github.event_name == 'release'
with:
artifacts: "canvas_syncer-${{ matrix.target }}.*"
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true