Skip to content

Commit fcd6991

Browse files
authored
Merge pull request #35 from lookbusy1344/claude/create-release-workflow-011CUKukJF7We9LEKMTueJXg
Add GitHub release workflow for multi-platform builds
2 parents 7ca768c + 920656a commit fcd6991

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

.github/workflows/release.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Release
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push:
8+
tags:
9+
- 'v*'
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
build:
16+
name: Build ${{ matrix.target }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
include:
21+
- target: aarch64-apple-darwin
22+
os: macos-latest
23+
name: hashrust-macos-arm64
24+
- target: x86_64-pc-windows-msvc
25+
os: windows-latest
26+
name: hashrust-windows-amd64.exe
27+
- target: aarch64-pc-windows-msvc
28+
os: windows-latest
29+
name: hashrust-windows-arm64.exe
30+
- target: x86_64-unknown-linux-gnu
31+
os: ubuntu-latest
32+
name: hashrust-linux-amd64
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Install Rust
38+
uses: dtolnay/rust-toolchain@stable
39+
with:
40+
targets: ${{ matrix.target }}
41+
42+
- name: Build
43+
run: cargo build --release --target ${{ matrix.target }}
44+
45+
- name: Prepare binary (Unix)
46+
if: matrix.os != 'windows-latest'
47+
run: |
48+
cp target/${{ matrix.target }}/release/hashrust ${{ matrix.name }}
49+
chmod +x ${{ matrix.name }}
50+
51+
- name: Prepare binary (Windows)
52+
if: matrix.os == 'windows-latest'
53+
run: |
54+
cp target/${{ matrix.target }}/release/hashrust.exe ${{ matrix.name }}
55+
56+
- name: Upload artifact
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: ${{ matrix.name }}
60+
path: ${{ matrix.name }}
61+
if-no-files-found: error
62+
63+
release:
64+
name: Create Release
65+
needs: build
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@v4
69+
70+
- name: Download all artifacts
71+
uses: actions/download-artifact@v4
72+
with:
73+
path: artifacts
74+
75+
- name: Display structure
76+
run: ls -R artifacts
77+
78+
- name: Create Release
79+
uses: softprops/action-gh-release@v1
80+
with:
81+
files: artifacts/*/*
82+
draft: false
83+
prerelease: false
84+
generate_release_notes: true
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)