File tree Expand file tree Collapse file tree 1 file changed +59
-0
lines changed
Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change 1+ on :
2+ push :
3+ tags :
4+ - ' v*'
5+
6+ name : Release Linux binary
7+
8+ jobs :
9+ build-and-release :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout
13+ uses : actions/checkout@v4
14+
15+ - name : Install Rust toolchain
16+ uses : actions-rs/toolchain@v1
17+ with :
18+ toolchain : stable
19+ profile : minimal
20+ override : true
21+
22+ - name : Cache Cargo
23+ uses : actions/cache@v4
24+ with :
25+ path : |
26+ ~/.cargo/registry
27+ ~/.cargo/git
28+ target
29+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
30+ restore-keys : |
31+ ${{ runner.os }}-cargo-
32+
33+ - name : Install jq
34+ run : sudo apt-get update && sudo apt-get install -y jq
35+
36+ - name : Determine binary name
37+ id : bin
38+ run : |
39+ BIN_NAME=$(cargo metadata --no-deps --format-version 1 \
40+ | jq -r '.packages[0].targets[] | select(.kind[] | index("bin")) | .name' \
41+ | head -n1)
42+ echo "bin_name=$BIN_NAME" >> $GITHUB_OUTPUT
43+
44+ - name : Build release (x86_64-unknown-linux-gnu)
45+ run : |
46+ rustup target add x86_64-unknown-linux-gnu
47+ cargo build --release --target x86_64-unknown-linux-gnu
48+
49+ - name : Package artifact
50+ run : |
51+ mkdir -p dist
52+ cp target/x86_64-unknown-linux-gnu/release/${{ steps.bin.outputs.bin_name }} dist/
53+ tar -C dist -czf dist/${{ steps.bin.outputs.bin_name }}-${{ github.ref_name }}-x86_64-unknown-linux-gnu.tar.gz ${{ steps.bin.outputs.bin_name }}
54+
55+ - name : Create release and upload artifact
56+ uses : ncipollo/release-action@v1
57+ with :
58+ tag : ${{ github.ref_name }}
59+ files : dist/*.tar.gz
You can’t perform that action at this time.
0 commit comments