Skip to content

Commit bb74641

Browse files
committed
feat: add github action of release
1 parent 267ed55 commit bb74641

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Release Binary
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build-and-release:
12+
name: Build & Publish Release
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
include:
17+
- target: x86_64-unknown-linux-musl
18+
arch: amd64
19+
- target: aarch64-unknown-linux-musl
20+
arch: aarch64
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Install Rust toolchain
27+
run: |
28+
rustup target add ${{ matrix.target }}
29+
30+
- name: Install Zig
31+
uses: mlugg/setup-zig@v2
32+
with:
33+
version: latest
34+
35+
- name: Install cargo-zigbuild
36+
run: cargo install cargo-zigbuild
37+
38+
- name: Build with cargo-zigbuild
39+
run: cargo zigbuild --release --target ${{ matrix.target }}
40+
env:
41+
cargo_build_version: ${{ github.event.release.tag_name }}
42+
43+
- name: Create Release Package
44+
run: |
45+
DIST_DIR="dn42-autopeer-daemon-${{ matrix.arch }}"
46+
mkdir -p "$DIST_DIR"
47+
cp "target/${{ matrix.target }}/release/dn42-autopeer-daemon" "$DIST_DIR/"
48+
cp "config.toml" "$DIST_DIR/"
49+
cp "dn42-autopeer-daemon.service" "$DIST_DIR/"
50+
tar -czvf "${DIST_DIR}.tar.gz" "$DIST_DIR"
51+
52+
- name: Upload Release Asset
53+
uses: softprops/action-gh-release@v2
54+
if: github.ref_type == 'tag'
55+
with:
56+
files: dn42-autopeer-daemon-${{ matrix.arch }}.tar.gz

0 commit comments

Comments
 (0)