File tree Expand file tree Collapse file tree 1 file changed +82
-0
lines changed
Expand file tree Collapse file tree 1 file changed +82
-0
lines changed Original file line number Diff line number Diff line change 1+ name : release
2+
3+ on :
4+ push :
5+ tags :
6+ - " v*"
7+
8+ permissions :
9+ contents : write # create GH release + upload assets
10+
11+ jobs :
12+ build :
13+ runs-on : ubuntu-latest
14+ strategy :
15+ matrix :
16+ target :
17+ - x86_64-unknown-linux-gnu
18+ - aarch64-unknown-linux-gnu
19+ - x86_64-apple-darwin
20+ - aarch64-apple-darwin
21+
22+ steps :
23+ - uses : actions/checkout@v4
24+
25+ - uses : dtolnay/rust-toolchain@stable
26+ with :
27+ targets : ${{ matrix.target }}
28+
29+ - uses : taiki-e/install-action@v2
30+ with :
31+ tool : cross
32+
33+ - name : Build
34+ run : cross build --release --target ${{ matrix.target }}
35+
36+ - name : Package
37+ shell : bash
38+ run : |
39+ set -eux
40+ VERSION="${GITHUB_REF_NAME}" # e.g. v0.1.1
41+ TARGET="${{ matrix.target }}"
42+ OUTDIR="dist"
43+ mkdir -p "$OUTDIR"
44+
45+ BIN="target/$TARGET/release/canine"
46+
47+ PKG="canine_${VERSION}_${TARGET}"
48+ mkdir -p "$PKG"
49+ cp "$BIN" "$PKG/"
50+
51+ tar -czf "$OUTDIR/$PKG.tar.gz" "$PKG"
52+
53+ - name : Upload artifacts to workflow run
54+ uses : actions/upload-artifact@v4
55+ with :
56+ name : dist-${{ matrix.target }}
57+ path : dist/*.tar.gz
58+
59+ release :
60+ runs-on : ubuntu-latest
61+ needs : build
62+ steps :
63+ - name : Download all artifacts
64+ uses : actions/download-artifact@v4
65+ with :
66+ path : dist
67+
68+ - name : Flatten dist
69+ shell : bash
70+ run : |
71+ set -eux
72+ mkdir -p out
73+ find dist -name "*.tar.gz" -exec cp {} out/ \;
74+ (cd out && shasum -a 256 *.tar.gz > SHA256SUMS)
75+
76+ - name : Create GitHub Release
77+ uses : softprops/action-gh-release@v2
78+ with :
79+ files : |
80+ out/*.tar.gz
81+ out/SHA256SUMS
82+
You can’t perform that action at this time.
0 commit comments