Build Release Binaries #5
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
# Based on https://github.com/typst/typst/blob/main/.github/workflows/release.yml | |
name: Build Release Binaries | |
on: | |
release: | |
types: [published] | |
jobs: | |
build-release: | |
name: release ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
cross: true | |
- target: aarch64-unknown-linux-gnu | |
os: ubuntu-latest | |
cross: true | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
cross: false | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
cross: false | |
- target: aarch64-apple-darwin | |
os: macos-latest | |
cross: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: mlugg/setup-zig@v1 | |
- name: Build linux binaries | |
if: ${{ matrix.cross }} | |
run: | | |
cargo install cargo-zigbuild | |
rustup target add ${{ matrix.target }} | |
cargo zigbuild -p filterx --release --target ${{ matrix.target }}.2.17 | |
mkdir -p target/${{ matrix.target }}.2.17/release | |
cp target/${{ matrix.target }}/release/filterx target/${{ matrix.target }}.2.17/release/filterx | |
cargo zigbuild -p filterx --release --target ${{ matrix.target }} | |
- name: Build windows/mac binaries | |
if: ${{ !matrix.cross }} | |
run: | | |
rustup target add ${{ matrix.target }} | |
cargo build -p filterx --release --target ${{ matrix.target }} | |
- name: create artifact directory | |
shell: bash | |
run: | | |
echo "target: ${{ matrix.target }}" | |
directory=filterx-${{ matrix.target }} | |
mkdir $directory | |
if [ -f target/${{ matrix.target }}/release/filterx ]; then | |
cp target/${{ matrix.target }}/release/filterx $directory/ | |
tar cJf $directory.tar.xz $directory/ | |
echo "artifact: $directory.tar.xz" | |
if [ -f target/${{ matrix.target }}.2.17/release/filterx ]; then | |
mkdir $directory.2.17 | |
cp target/${{ matrix.target }}.2.17/release/filterx $directory.2.17/ | |
tar cJf $directory.2.17.tar.xz $directory.2.17/ | |
echo "artifact: $directory.2.17.tar.xz" | |
fi | |
fi | |
if [ -f target/${{ matrix.target }}/release/filterx.exe ]; then | |
cp target/${{ matrix.target }}/release/filterx.exe $directory/ | |
7z a $directory.zip $directory/ | |
echo "artifact: $directory.zip" | |
fi | |
- uses: ncipollo/release-action@v1.14.0 | |
with: | |
artifacts: "*.tar.xz" | |
allowUpdates: true | |
omitNameDuringUpdate: true | |
omitBodyDuringUpdate: true |