Release #1
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
name: Release | |
on: | |
workflow_dispatch: | |
release: | |
branches: [ master ] | |
types: [ published ] | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [ x86_64-unknown-linux-gnu, x86_64-pc-windows-gnu, x86_64-apple-darwin, aarch64-apple-darwin, aarch64-unknown-linux-gnu ] | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: "Setup Rust" | |
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' || matrix.target == 'x86_64-pc-windows-gnu' || matrix.target == 'aarch64-unknown-linux-gnu' }} | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: 1.80.0 | |
target: ${{ matrix.target }} | |
- name: "Install dependencies (Linux)" | |
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' || matrix.target == 'aarch64-unknown-linux-gnu' }} | |
run: sudo apt update && sudo apt install -y libdbus-1-dev pkg-config | |
- name: "Install dependencies (Windows)" | |
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }} | |
run: sudo apt update && sudo apt install -y pkg-config gcc-mingw-w64-x86-64 | |
- name: "Build target (Linux and Windows)" | |
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' || matrix.target == 'x86_64-pc-windows-gnu' || matrix.target == 'aarch64-unknown-linux-gnu' }} | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: "Build target (macOS amd64)" | |
if: ${{ matrix.target == 'x86_64-apple-darwin' }} | |
run: | | |
docker run --rm \ | |
-v ${{ github.workspace }}:/src \ | |
-w /src \ | |
-e CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse \ | |
-e CC=o64-clang \ | |
-e CXX=o64-clang++ \ | |
-e LIBZ_SYS_STATIC=1 \ | |
joseluisq/rust-linux-darwin-builder:1.79.0 \ | |
sh -c "cargo build --release --target x86_64-apple-darwin" | |
- name: "Build target (macOS arm64)" | |
if: ${{ matrix.target == 'aarch64-apple-darwin' }} | |
run: | | |
docker run --rm \ | |
-v $PWD:/src \ | |
-w /src \ | |
-e CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse \ | |
-e CC=oa64-clang \ | |
-e CXX=oa64-clang++ \ | |
-e LIBZ_SYS_STATIC=1 \ | |
joseluisq/rust-linux-darwin-builder:1.79.0 \ | |
sh -c "cargo build --release --target aarch64-apple-darwin" | |
- name: "Package" | |
shell: bash | |
run: | | |
cd ${{ github.workspace }}/target/${{ matrix.target }}/release | |
tar czf ${{ github.workspace }}/${{ github.event.repository.name }}-${{ matrix.target }}.tar.gz $([ -f "${{ github.event.repository.name }}.exe" ] && echo "${{ github.event.repository.name }}.exe" || echo "${{ github.event.repository.name }}") | |
cd - | |
- name: "Publish" | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: '${{ github.event.repository.name }}-*' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |