Skip to content

Commit 7c9c707

Browse files
committed
ci: add release workflow for tagged builds
1 parent 7775b92 commit 7c9c707

1 file changed

Lines changed: 96 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build (${{ matrix.name }})
14+
runs-on: ${{ matrix.runner }}
15+
timeout-minutes: 40
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- name: macos-arm64
21+
runner: macos-latest
22+
target: aarch64-apple-darwin
23+
artifact_name: slipstream-macos-arm64
24+
- name: linux-x86_64
25+
runner: ubuntu-latest
26+
target: x86_64-unknown-linux-gnu
27+
artifact_name: slipstream-linux-x86_64
28+
steps:
29+
- name: Check out
30+
uses: actions/checkout@v4
31+
with:
32+
submodules: recursive
33+
34+
- name: Install build dependencies (Linux)
35+
if: runner.os == 'Linux'
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y cmake pkg-config libssl-dev python3
39+
40+
- name: Install build dependencies (macOS)
41+
if: runner.os == 'macOS'
42+
run: |
43+
brew install cmake pkg-config openssl@3
44+
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> "$GITHUB_ENV"
45+
echo "PKG_CONFIG_PATH=$(brew --prefix openssl@3)/lib/pkgconfig" >> "$GITHUB_ENV"
46+
47+
- name: Set up Rust
48+
uses: dtolnay/rust-toolchain@stable
49+
with:
50+
targets: ${{ matrix.target }}
51+
52+
- name: Build
53+
run: |
54+
cargo build -p slipstream-client --release --target ${{ matrix.target }}
55+
cargo build -p slipstream-server --release --target ${{ matrix.target }}
56+
57+
- name: Package
58+
shell: bash
59+
run: |
60+
set -euo pipefail
61+
base="${{ matrix.artifact_name }}"
62+
bin_dir="target/${{ matrix.target }}/release"
63+
mkdir -p dist
64+
cp "${bin_dir}/slipstream-client" dist/
65+
cp "${bin_dir}/slipstream-server" dist/
66+
tar -czf "${base}.tar.gz" -C dist slipstream-client slipstream-server
67+
if command -v sha256sum >/dev/null 2>&1; then
68+
sha256sum "${base}.tar.gz" > "${base}.tar.gz.sha256"
69+
else
70+
shasum -a 256 "${base}.tar.gz" > "${base}.tar.gz.sha256"
71+
fi
72+
73+
- name: Upload artifact
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: ${{ matrix.artifact_name }}
77+
path: |
78+
*.tar.gz
79+
*.sha256
80+
81+
release:
82+
name: Create Release
83+
needs: build
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Download artifacts
87+
uses: actions/download-artifact@v4
88+
with:
89+
path: artifacts
90+
merge-multiple: true
91+
92+
- name: Create GitHub Release
93+
uses: softprops/action-gh-release@v2
94+
with:
95+
generate_release_notes: true
96+
files: artifacts/*

0 commit comments

Comments
 (0)