Repository navigation
88 lines (75 loc) · 2.26 KB
/
Copy pathrelease.yml
File metadata and controls
88 lines (75 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
# guards against publishing a tag that disagrees with the crate version.
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: verify tag matches crate version
run: |
crate="$(grep -m1 '^version = ' Cargo.toml | cut -d'"' -f2)"
if [ "v$crate" != "$GITHUB_REF_NAME" ]; then
echo "tag $GITHUB_REF_NAME does not match Cargo.toml version $crate" >&2
exit 1
fi
build:
needs: verify
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
- target: aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
- target: aarch64-apple-darwin
runner: macos-latest
- target: x86_64-apple-darwin
runner: macos-latest
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v5
- name: install rust target
run: rustup target add ${{ matrix.target }}
- name: build
run: make build-release TARGET=${{ matrix.target }}
- name: package
run: |
name="hrns-$GITHUB_REF_NAME-${{ matrix.target }}"
mkdir -p "dist/$name"
cp "target/${{ matrix.target }}/release/hrns" "dist/$name/"
cp README.md LICENSE hrns.example.toml "dist/$name/"
tar -C dist -czf "dist/$name.tar.gz" "$name"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: dist/*.tar.gz
if-no-files-found: error
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: checksums
working-directory: dist
run: sha256sum *.tar.gz > SHA256SUMS
- name: create release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
gh release create "$GITHUB_REF_NAME" \
--title "$GITHUB_REF_NAME" \
--generate-notes \
dist/*.tar.gz dist/SHA256SUMS