Skip to content

Commit bd67db9

Browse files
Add GitHub release workflow for cross-platform binary builds
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 121ff82 commit bd67db9

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "release-[0-9]+.[0-9]+.[0-9]+*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
strategy:
14+
matrix:
15+
include:
16+
- target: aarch64-apple-darwin
17+
os: macos-latest
18+
artifact: ralph-macos-arm64
19+
- target: x86_64-apple-darwin
20+
os: macos-latest
21+
artifact: ralph-macos-x86_64
22+
- target: x86_64-pc-windows-msvc
23+
os: windows-latest
24+
artifact: ralph-windows-x86_64
25+
- target: aarch64-pc-windows-msvc
26+
os: windows-latest
27+
artifact: ralph-windows-arm64
28+
- target: x86_64-unknown-linux-gnu
29+
os: ubuntu-latest
30+
artifact: ralph-linux-x86_64
31+
- target: aarch64-unknown-linux-gnu
32+
os: ubuntu-latest
33+
artifact: ralph-linux-arm64
34+
35+
runs-on: ${{ matrix.os }}
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Install Rust toolchain
41+
uses: dtolnay/rust-toolchain@stable
42+
with:
43+
targets: ${{ matrix.target }}
44+
45+
- name: Install cross-compilation tools (Linux ARM64)
46+
if: matrix.target == 'aarch64-unknown-linux-gnu'
47+
run: |
48+
sudo apt-get update
49+
sudo apt-get install -y gcc-aarch64-linux-gnu
50+
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
51+
52+
- name: Build
53+
run: cargo build --release --target ${{ matrix.target }} -p ralph-cli
54+
55+
- name: Prepare artifact (Unix)
56+
if: runner.os != 'Windows'
57+
run: |
58+
cp target/${{ matrix.target }}/release/ralph ${{ matrix.artifact }}
59+
chmod +x ${{ matrix.artifact }}
60+
61+
- name: Prepare artifact (Windows)
62+
if: runner.os == 'Windows'
63+
run: cp target/${{ matrix.target }}/release/ralph.exe ${{ matrix.artifact }}.exe
64+
65+
- name: Upload artifact
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: ${{ matrix.artifact }}
69+
path: ${{ matrix.artifact }}${{ runner.os == 'Windows' && '.exe' || '' }}
70+
71+
release:
72+
needs: build
73+
runs-on: ubuntu-latest
74+
75+
steps:
76+
- name: Extract version from tag
77+
id: version
78+
run: echo "version=${GITHUB_REF_NAME#release-}" >> $GITHUB_OUTPUT
79+
80+
- name: Download all artifacts
81+
uses: actions/download-artifact@v4
82+
with:
83+
path: artifacts
84+
85+
- name: Create GitHub Release
86+
uses: softprops/action-gh-release@v2
87+
with:
88+
name: v${{ steps.version.outputs.version }}
89+
generate_release_notes: true
90+
files: artifacts/**/*

0 commit comments

Comments
 (0)