-
Notifications
You must be signed in to change notification settings - Fork 4
142 lines (121 loc) · 5.08 KB
/
Copy pathrelease.yml
File metadata and controls
142 lines (121 loc) · 5.08 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# T81 Foundation Release Workflow
#
# Triggered by a semantic version tag (v*.*.*). Produces one prebuilt archive
# per platform so users can run `t81` without compiling from source.
#
# Artifacts:
# t81-<tag>-linux-x86_64.tar.gz
# t81-<tag>-linux-arm64.tar.gz
# t81-<tag>-macos-arm64.tar.gz
# t81-<tag>-macos-x86_64.tar.gz
# t81-<tag>-windows-x86_64.zip
# sbom.spdx.json
name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
# ──────────────────────────────────────────────────────────────────────────
# Build a release binary on every supported platform and upload as an
# ephemeral Actions artifact so the release job can gather them all.
# ──────────────────────────────────────────────────────────────────────────
build:
name: Build (${{ matrix.platform }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- platform: linux-x86_64
os: ubuntu-24.04
- platform: linux-arm64
os: ubuntu-24.04-arm
- platform: macos-arm64
os: macos-14
- platform: macos-x86_64
os: macos-15-intel
- platform: windows-x86_64
os: windows-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
build-essential cmake ninja-build
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install cmake ninja
# Ninja is pre-installed on GitHub's Windows runners.
- name: Configure
run: >
cmake -S . -B build
-G Ninja
-DCMAKE_BUILD_TYPE=Release
-DT81_BUILD_TESTS=OFF
-DT81_BUILD_EXAMPLES=OFF
-DT81_BUILD_BENCHMARKS=OFF
- name: Build
run: cmake --build build --parallel
- name: Install to staging directory
run: cmake --install build --prefix dist
# ── Packaging ────────────────────────────────────────────────────────
- name: Package (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
ARCHIVE="t81-${GITHUB_REF_NAME}-${{ matrix.platform }}.tar.gz"
tar -czf "$ARCHIVE" -C dist .
echo "ARCHIVE=$ARCHIVE" >> "$GITHUB_ENV"
- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$Archive = "t81-$env:GITHUB_REF_NAME-${{ matrix.platform }}.zip"
Compress-Archive -Path dist\* -DestinationPath $Archive
"ARCHIVE=$Archive" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Upload artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: t81-${{ matrix.platform }}
path: ${{ env.ARCHIVE }}
retention-days: 1
# ──────────────────────────────────────────────────────────────────────────
# Gather all platform archives, generate an SBOM, and publish the release.
# ──────────────────────────────────────────────────────────────────────────
release:
name: Create Release
needs: build
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download all platform artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: 't81-*'
path: artifacts
merge-multiple: true
# Make install scripts available as top-level release assets so the
# one-liner URLs (.../releases/latest/download/install.sh) resolve.
- name: Copy install scripts to artifacts
run: cp install.sh install.ps1 artifacts/
- name: Generate SBOM
uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
with:
path: ./artifacts/
artifact-name: sbom.spdx.json
- name: Create GitHub Release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
with:
generate_release_notes: true
files: |
artifacts/**
sbom.spdx.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}