Skip to content

Commit b632511

Browse files
committed
github workflow to build and publish release binaries
1 parent 8f5054e commit b632511

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.github/workflows/release.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-release:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
include:
17+
- os: ubuntu-latest
18+
target: x86_64-unknown-linux-gnu
19+
name: regroot-linux-amd64
20+
- os: windows-latest
21+
target: x86_64-pc-windows-msvc
22+
name: regroot-windows-amd64.exe
23+
- os: macos-latest
24+
target: x86_64-apple-darwin
25+
name: regroot-macos-amd64
26+
- os: macos-latest
27+
target: aarch64-apple-darwin
28+
name: regroot-macos-arm64
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Install Rust
34+
uses: dtolnay/rust-toolchain@stable
35+
with:
36+
targets: ${{ matrix.target }}
37+
38+
- name: Build binary
39+
run: cargo build --release --target ${{ matrix.target }}
40+
41+
- name: Prepare asset
42+
shell: bash
43+
run: |
44+
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
45+
cp "target/${{ matrix.target }}/release/regroot.exe" "target/${{ matrix.name }}"
46+
else
47+
cp "target/${{ matrix.target }}/release/regroot" "target/${{ matrix.name }}"
48+
fi
49+
50+
- name: Release
51+
uses: softprops/action-gh-release@v2
52+
if: success()
53+
with:
54+
files: target/${{ matrix.name }}
55+
generate_release_notes: true
56+
fail_on_unmatched_files: true
57+
58+
build-linux-arm64:
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
63+
- name: Install Rust
64+
uses: dtolnay/rust-toolchain@stable
65+
with:
66+
targets: aarch64-unknown-linux-gnu
67+
68+
- name: Install cross
69+
run: cargo install cross
70+
71+
- name: Build ARM64 binary
72+
run: cross build --release --target aarch64-unknown-linux-gnu
73+
74+
- name: Prepare asset
75+
run: cp target/aarch64-unknown-linux-gnu/release/regroot target/regroot-linux-arm64
76+
77+
- name: Release
78+
uses: softprops/action-gh-release@v2
79+
if: success()
80+
with:
81+
files: target/regroot-linux-arm64
82+
generate_release_notes: true
83+
fail_on_unmatched_files: true

0 commit comments

Comments
 (0)