Skip to content

Commit 9a657f4

Browse files
authored
ci: release flow (#7)
1 parent d92d4d3 commit 9a657f4

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Release Wasm
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: Release tag (e.g., v1.2.3)
11+
required: true
12+
type: string
13+
14+
permissions:
15+
contents: write
16+
17+
env:
18+
CARGO_TERM_COLOR: always
19+
RUST_VERSION: 1.81.0
20+
21+
jobs:
22+
release:
23+
name: Build and Release
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
- name: Set up Rust (stable) + wasm target
30+
uses: dtolnay/rust-toolchain@stable
31+
with:
32+
toolchain: ${{ env.RUST_VERSION }}
33+
targets: wasm32-unknown-unknown
34+
- name: Install protoc
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y protobuf-compiler
38+
protoc --version
39+
- name: Install wasm-opt
40+
run: cargo install wasm-opt --locked
41+
- name: WASM release build
42+
run: RUSTFLAGS="-C link-arg=-s" cargo wasm --locked
43+
- name: Optimize WASM artifacts
44+
run: |
45+
mkdir artifacts
46+
for f in target/wasm32-unknown-unknown/release/*.wasm; do
47+
wasm-opt -Os "$f" -o "artifacts/$(basename "$f")"
48+
done
49+
- name: Generate checksums
50+
run: |
51+
cd artifacts
52+
sha256sum -- *.wasm | tee checksums.txt
53+
- name: Create GitHub Release and upload assets
54+
uses: softprops/action-gh-release@v2
55+
with:
56+
tag_name: ${{ github.ref_name }}
57+
target_commitish: ${{ github.sha }}
58+
generate_release_notes: true
59+
files: |
60+
artifacts/*.wasm
61+
artifacts/checksums.txt
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)