Skip to content

Commit 8edd535

Browse files
chore: Create github actions workflow to build binaries and upload it to github release
1 parent 4705f47 commit 8edd535

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

.github/workflows/release.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Release
2+
3+
4+
on:
5+
push:
6+
tags:
7+
- "v*.*.*" # Only run on version tags like v1.0.0
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build:
14+
name: Build binaries
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Install Rust
25+
uses: dtolnay/rust-toolchain@stable
26+
27+
- name: Build release binary
28+
run: cargo build --release --workspace
29+
30+
- name: Rename binaries (Linux)
31+
if: runner.os == 'Linux'
32+
run: |
33+
mv target/release/null-talk-client null-talk-linux-client-v${{ github.ref_name }}
34+
mv target/release/null-talk-server null-talk-linux-server-v${{ github.ref_name }}
35+
36+
- name: Rename binaries (Windows)
37+
if: runner.os == 'Windows'
38+
run: |
39+
ren target\release\null-talk-client.exe null-talk-windows-client-v${{ github.ref_name }}.exe
40+
ren target\release\null-talk-server.exe null-talk-windows-server-v${{ github.ref_name }}.exe
41+
42+
- name: Rename binaries (macOS)
43+
if: runner.os == 'macOS'
44+
run: |
45+
mv target/release/null-talk-client null-talk-macos-client-v${{ github.ref_name }}
46+
mv target/release/null-talk-server null-talk-macos-server-v${{ github.ref_name }}
47+
48+
- name: Upload binaries as artifacts
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: null-talk-${{ matrix.os }}
52+
path: |
53+
target/release/null-talk-*-client-v${{ github.ref_name }}*
54+
target/release/null-talk-*-server-v${{ github.ref_name }}*
55+
56+
release:
57+
name: Upload to GitHub Releases
58+
needs: build
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@v4
64+
65+
- name: Download build artifacts
66+
uses: actions/download-artifact@v4
67+
with:
68+
path: ./artifacts
69+
70+
71+
- name: Upload release assets
72+
uses: softprops/action-gh-release@v2
73+
with:
74+
files: |
75+
null-talk-*-client-v${{ github.ref_name }}*
76+
null-talk-*-server-v${{ github.ref_name }}*
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)