Skip to content

Commit

Permalink
github workflow to build and publish release binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
Z1xus committed Jan 3, 2025
1 parent 8f5054e commit b632511
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
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

0 comments on commit b632511

Please sign in to comment.