Krolyxon
Commit 8f664fb

ferrenium.githubworkflowsrelease.yml

63 lines · 2.0 KB · YAML

1name: release
2
3on:
4 push:
5 tags: ["v*"]
6
7permissions:
8 contents: write
9
10jobs:
11 test:
12 runs-on: ubuntu-latest
13 steps:
14 - uses: actions/checkout@v4
15 - name: Tag matches Cargo.toml
16 run: |
17 version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)
18 if [ "v$version" != "$GITHUB_REF_NAME" ]; then
19 echo "tag $GITHUB_REF_NAME does not match Cargo.toml version $version"
20 exit 1
21 fi
22 - run: cargo fmt --check
23 - run: cargo clippy --all-targets --locked -- -D warnings
24 - run: cargo test --release --locked
25
26 build:
27 needs: test
28 runs-on: ubuntu-latest
29 strategy:
30 matrix:
31 arch: [x86_64, aarch64]
32 steps:
33 - uses: actions/checkout@v4
34 - name: Install cargo-zigbuild
35 run: |
36 python3 -m venv "$RUNNER_TEMP/zig"
37 "$RUNNER_TEMP/zig/bin/pip" install --quiet cargo-zigbuild
38 echo "$RUNNER_TEMP/zig/bin" >> "$GITHUB_PATH"
39 rustup target add ${{ matrix.arch }}-unknown-linux-gnu
40 # Linked against glibc 2.28, so it runs on Debian 10+, Ubuntu 20.04+, RHEL 8+.
41 - run: cargo zigbuild --release --locked --target ${{ matrix.arch }}-unknown-linux-gnu.2.28
42 - run: tar -czf ferrenium-${{ matrix.arch }}-linux.tar.gz -C target/${{ matrix.arch }}-unknown-linux-gnu/release ferrenium
43 - uses: actions/upload-artifact@v4
44 with:
45 name: ferrenium-${{ matrix.arch }}
46 path: ferrenium-${{ matrix.arch }}-linux.tar.gz
47
48 release:
49 needs: build
50 runs-on: ubuntu-latest
51 steps:
52 - uses: actions/checkout@v4
53 - uses: actions/download-artifact@v4
54 with:
55 merge-multiple: true
56 - name: Publish
57 env:
58 GH_TOKEN: ${{ github.token }}
59 run: |
60 cp dist/install.sh .
61 sha256sum ferrenium-*-linux.tar.gz install.sh > SHA256SUMS
62 gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --generate-notes \
63 ferrenium-*-linux.tar.gz install.sh SHA256SUMS