Skip to content

Commit 1659715

Browse files
committed
Add release workflow
1 parent c3078aa commit 1659715

2 files changed

Lines changed: 71 additions & 0 deletions

File tree

.github/workflows/release.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
on:
2+
release:
3+
types: [created]
4+
workflow_dispatch:
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
11+
- run: |
12+
cargo test --all-features --verbose
13+
14+
build:
15+
needs: [test]
16+
runs-on: ${{ matrix.platform.runner }}
17+
strategy:
18+
matrix:
19+
platform:
20+
- runner: ubuntu-22.04
21+
target: x86_64-unknown-linux-musl
22+
- runner: ubuntu-22.04
23+
target: aarch64-unknown-linux-musl
24+
- runner: macos-15
25+
target: x86_64-apple-darwin
26+
- runner: macos-15-arm
27+
target: aarch64-apple-darwin
28+
steps:
29+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
30+
- run: |
31+
./bin/build ${{ matrix.platform.target }} ${{ github.ref }}
32+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
33+
with:
34+
name: nb-${{ matrix.platform.target }}
35+
path: nb-*
36+
37+
release:
38+
name: Release
39+
runs-on: ubuntu-latest
40+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
41+
needs: [build]
42+
permissions:
43+
# Use to sign the release artifacts
44+
id-token: write
45+
# Used to upload release artifacts
46+
contents: write
47+
# Used to generate artifact attestation
48+
attestations: write
49+
steps:
50+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
51+
- run: |
52+
sha256sum *.tar.gz >SHA256SUMS
53+
- uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
54+
with:
55+
subject-path: 'nb-*'
56+
subject-checksums: SHA256SUMS
57+
- uses: svenstaro/upload-release-action@81c65b7cd4de9b2570615ce3aad67a41de5b1a13 # latest
58+
with:
59+
file: '*.tar.gz'
60+
file_glob: true
61+
- uses: svenstaro/upload-release-action@81c65b7cd4de9b2570615ce3aad67a41de5b1a13 # latest
62+
with:
63+
file: SHA256SUMS

bin/build

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -euxo pipefail
3+
4+
TARGET="${1:?target}"
5+
VERSION="${2:?version}"
6+
7+
cargo build --all-features --release --target "${TARGET}" --verbose
8+
tar -cvzf "nb-${VERSION}-${TARGET}.tar.gz" -C "target/${TARGET}/release" nb

0 commit comments

Comments
 (0)