Accipit Build and Release #9
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: Accipit Build and Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'release/**' | |
path: | |
- 'src/**' | |
- 'Cargo.toml' | |
- '.github/workflows/accipit-build.yml' | |
pull_request: | |
branches: | |
- 'release/**' | |
paths: | |
- 'src/**' | |
- 'Cargo.toml' | |
- '.github/workflows/accipit-build.yml' | |
jobs: | |
build: | |
name: Build ${{ matrix.platform.target }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
asset: accipit-linux-aarch64-musl | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
asset: accipit-linux-x86_64-musl | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
asset: accipit-linux-x86_64-gnu | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
asset: accipit-windows-x86_64-msvc.exe | |
- os: windows-latest | |
target: x86_64-pc-windows-gnu | |
asset: accipit-windows-x86_64-gnu.exe | |
- os: macOS-latest | |
target: x86_64-apple-darwin | |
asset: accipit-darwin-x86_64 | |
- os: macOS-latest | |
target: aarch64-apple-darwin | |
asset: accipit-darwin-aarch64 | |
toolchain: | |
- stable | |
runs-on: ${{ matrix.platform.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build binary | |
uses: houseabsolute/actions-rust-cross@v0 | |
with: | |
command: "build" | |
target: ${{ matrix.platform.target }} | |
toolchain: ${{ matrix.toolchain }} | |
args: "--release" | |
strip: true | |
- name: Rename binary (linux and macos) | |
run: mv target/${{ matrix.platform.target }}/release/accipit target/${{ matrix.platform.target }}/release/${{ matrix.platform.asset }} | |
if: ${{ startsWith(matrix.platform.os, 'ubuntu') || startsWith(matrix.platform.os, 'macOS') }} | |
- name: Rename binary (windows) | |
run: mv target/${{ matrix.platform.target }}/release/accipit.exe target/${{ matrix.platform.target }}/release/${{ matrix.platform.asset }} | |
if: ${{ startsWith(matrix.platform.os, 'windows') }} | |
- name: Generate SHA-256 | |
run: shasum -a 256 target/${{ matrix.platform.target }}/release/${{ matrix.platform.asset }} | cut -d ' ' -f 1 > target/${{ matrix.platform.target }}/release/${{ matrix.platform.asset }}.sha256 | |
- name: Release binary and SHA-256 checksum to GitHub | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: ${{ matrix.platform.asset }} | |
path: | | |
target/${{ matrix.platform.target }}/release/${{ matrix.platform.asset }} | |
target/${{ matrix.platform.target }}/release/${{ matrix.platform.asset }}.sha256 |