-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (72 loc) · 2.34 KB
/
release.yml
File metadata and controls
83 lines (72 loc) · 2.34 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
name: release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: build (${{ matrix.target }})
strategy:
fail-fast: false
matrix:
include:
- os: macos-14
target: aarch64-apple-darwin
# Cross-compile x86_64 from the arm64 macOS-14 host. The macOS-13
# free-tier runner queue has been unreliable; this avoids it
# entirely. The Apple SDK on macOS-14 contains both architectures.
- os: macos-14
target: x86_64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
cross: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: install rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.target }}
- name: install cross-compiler (linux aarch64)
if: matrix.cross == true
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
mkdir -p .cargo
cat >> .cargo/config.toml <<'EOF'
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
EOF
- name: build
run: cargo build --release --target ${{ matrix.target }} --bin microcode
- name: package
shell: bash
run: |
set -e
version="${GITHUB_REF#refs/tags/v}"
asset="microcode-${version}-${{ matrix.target }}.tar.gz"
mkdir -p dist
cp "target/${{ matrix.target }}/release/microcode" dist/microcode
if [ "${{ runner.os }}" != "Windows" ]; then
strip dist/microcode || true
fi
tar -C dist -czf "dist/${asset}" microcode
echo "ASSET=dist/${asset}" >> "$GITHUB_ENV"
( cd dist && shasum -a 256 "${asset}" > "${asset}.sha256" )
echo "SUM=dist/${asset}.sha256" >> "$GITHUB_ENV"
- name: upload to release
uses: softprops/action-gh-release@v2
with:
files: |
${{ env.ASSET }}
${{ env.SUM }}
fail_on_unmatched_files: true
generate_release_notes: true