github workflow to build and publish release binaries #2
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
name: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
jobs: | |
build-release: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
name: regroot-linux-amd64 | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
name: regroot-windows-amd64.exe | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
name: regroot-macos-amd64 | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
name: regroot-macos-arm64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Build binary | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Prepare asset | |
shell: bash | |
run: | | |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
cp "target/${{ matrix.target }}/release/regroot.exe" "target/${{ matrix.name }}" | |
else | |
cp "target/${{ matrix.target }}/release/regroot" "target/${{ matrix.name }}" | |
fi | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: success() | |
with: | |
files: target/${{ matrix.name }} | |
generate_release_notes: true | |
fail_on_unmatched_files: true | |
build-linux-arm64: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-unknown-linux-gnu | |
- name: Install cross | |
run: cargo install cross | |
- name: Build ARM64 binary | |
run: cross build --release --target aarch64-unknown-linux-gnu | |
- name: Prepare asset | |
run: cp target/aarch64-unknown-linux-gnu/release/regroot target/regroot-linux-arm64 | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: success() | |
with: | |
files: target/regroot-linux-arm64 | |
generate_release_notes: true | |
fail_on_unmatched_files: true |