Skip to content

Commit ac22dcd

Browse files
authored
release v0.0.1 (#27)
* release v0.0.1 Signed-off-by: kerthcet <kerthcet@gmail.com> * fix lint Signed-off-by: kerthcet <kerthcet@gmail.com> --------- Signed-off-by: kerthcet <kerthcet@gmail.com>
1 parent 45ad881 commit ac22dcd

7 files changed

Lines changed: 286 additions & 128 deletions

File tree

.github/workflows/release.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
build:
16+
name: Build ${{ matrix.asset }}
17+
runs-on: ${{ matrix.runner }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
# Linux builds target musl and link statically, so one binary per arch
23+
# runs on any distro regardless of glibc version.
24+
- runner: ubuntu-22.04
25+
target: x86_64-unknown-linux-musl
26+
asset: sandd-linux-amd64
27+
- runner: ubuntu-22.04-arm
28+
target: aarch64-unknown-linux-musl
29+
asset: sandd-linux-arm64
30+
- runner: macos-13
31+
target: x86_64-apple-darwin
32+
asset: sandd-darwin-amd64
33+
- runner: macos-14
34+
target: aarch64-apple-darwin
35+
asset: sandd-darwin-arm64
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Install Rust toolchain
40+
uses: actions-rust-lang/setup-rust-toolchain@v1
41+
with:
42+
toolchain: stable
43+
target: ${{ matrix.target }}
44+
45+
- name: Install musl tools
46+
if: endsWith(matrix.target, '-musl')
47+
run: sudo apt-get update && sudo apt-get install -y musl-tools
48+
49+
- name: Build daemon
50+
run: cargo build --package sandd --release --locked --target ${{ matrix.target }}
51+
52+
- name: Rename binary
53+
run: mv target/${{ matrix.target }}/release/sandd ${{ matrix.asset }}
54+
55+
- name: Verify static linking
56+
if: endsWith(matrix.target, '-musl')
57+
run: |
58+
# rustc emits a static-PIE for musl targets, which `file` reports as
59+
# "static-pie linked" rather than "statically linked" -- accept either.
60+
file ${{ matrix.asset }}
61+
if ! file ${{ matrix.asset }} | grep -qE "static-pie linked|statically linked"; then
62+
echo "::error::Expected a statically linked musl binary."
63+
exit 1
64+
fi
65+
66+
- name: Verify binary runs
67+
run: ./${{ matrix.asset }} --help
68+
69+
- name: Upload artifact
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: ${{ matrix.asset }}
73+
path: ${{ matrix.asset }}
74+
if-no-files-found: error
75+
76+
release:
77+
name: Publish release
78+
needs: build
79+
runs-on: ubuntu-latest
80+
steps:
81+
- name: Download artifacts
82+
uses: actions/download-artifact@v4
83+
with:
84+
path: artifacts
85+
merge-multiple: true
86+
87+
- name: Generate checksums
88+
run: |
89+
cd artifacts
90+
sha256sum sandd-* > sandd-checksums.txt
91+
cat sandd-checksums.txt
92+
93+
- name: Create release
94+
env:
95+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96+
run: |
97+
gh release create "$GITHUB_REF_NAME" \
98+
--repo "$GITHUB_REPOSITORY" \
99+
--title "$GITHUB_REF_NAME" \
100+
--generate-notes \
101+
artifacts/*

0 commit comments

Comments
 (0)