-
Notifications
You must be signed in to change notification settings - Fork 5
321 lines (277 loc) · 11.4 KB
/
Copy pathrelease-beta.yml
File metadata and controls
321 lines (277 loc) · 11.4 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
name: Release (Beta)
# Beta channel is enabled for GitHub prereleases.
#
# Keep BETA_CHANNEL_ENABLED as an emergency brake: set the repository variable
# to `false` or unset it to skip beta jobs without editing the workflow.
on:
release:
types: [published]
workflow_dispatch:
inputs:
release_tag:
description: "Existing prerelease tag to rebuild and publish, for example v0.1.0-beta.1"
required: true
type: string
# Only runs for prerelease tags — stable releases handled by release.yml
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.event.release.tag_name }}
concurrency:
group: release-beta-${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.event.release.tag_name }}
cancel-in-progress: false
jobs:
build:
name: Build ${{ matrix.name }}
if: vars.BETA_CHANNEL_ENABLED == 'true' && (github.event_name == 'workflow_dispatch' || github.event.release.prerelease)
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: aarch64-macos
runner: macos-14
target: aarch64-apple-darwin
bottle_tag: arm64_sonoma
archive: tar.gz
- name: x86_64-linux
runner: ubuntu-22.04
target: x86_64-unknown-linux-gnu
bottle_tag: x86_64_linux
archive: tar.gz
- name: aarch64-linux
runner: ubuntu-22.04-arm
target: aarch64-unknown-linux-gnu
archive: tar.gz
- name: x86_64-windows
runner: windows-latest
target: x86_64-pc-windows-msvc
archive: zip
steps:
- name: Validate manual prerelease rebuild
if: github.event_name == 'workflow_dispatch'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
test "$(gh release view "$RELEASE_TAG" --repo "${{ github.repository }}" --json isPrerelease --jq .isPrerelease)" = true
- uses: actions/checkout@v4
with:
ref: ${{ env.RELEASE_TAG }}
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: dashboard/package-lock.json
- name: Build dashboard assets
working-directory: dashboard
run: |
npm ci
npm run build
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: ./.github/actions/setup-linux-mold
- name: Use lld-link
if: runner.os == 'Windows'
shell: pwsh
run: |
where.exe lld-link
lld-link --version
"RUSTFLAGS=-C linker=lld-link.exe" >> $env:GITHUB_ENV
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-${{ matrix.target }}-cargo-beta-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-beta-
${{ runner.os }}-${{ matrix.target }}-cargo-
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Get version
id: version
shell: bash
run: |
VERSION="${RELEASE_TAG#v}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
# --- Binary archive (all platforms) ---
- name: Package binary (unix)
if: matrix.archive == 'tar.gz'
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../tracedecay-beta-${{ env.RELEASE_TAG }}-${{ matrix.name }}.tar.gz tracedecay
cd ../../..
- name: Package binary (windows)
if: matrix.archive == 'zip'
shell: pwsh
run: |
Compress-Archive -Path target/${{ matrix.target }}/release/tracedecay.exe -DestinationPath tracedecay-beta-${{ env.RELEASE_TAG }}-${{ matrix.name }}.zip
- name: Upload binary archive
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: gh release upload "$RELEASE_TAG" tracedecay-beta-${{ env.RELEASE_TAG }}-${{ matrix.name }}.${{ matrix.archive }} --clobber
# --- Homebrew bottle (only for platforms with bottle_tag) ---
- name: Package Homebrew bottle
if: matrix.bottle_tag
run: |
VERSION="${{ steps.version.outputs.version }}"
BOTTLE_TAG="${{ matrix.bottle_tag }}"
mkdir -p tracedecay-beta/${VERSION}/bin
cp target/${{ matrix.target }}/release/tracedecay tracedecay-beta/${VERSION}/bin/tracedecay
chmod +x tracedecay-beta/${VERSION}/bin/tracedecay
tar czf "tracedecay-beta-${VERSION}.${BOTTLE_TAG}.bottle.tar.gz" tracedecay-beta/
- name: Upload bottle artifact
if: matrix.bottle_tag
uses: actions/upload-artifact@v4
with:
name: bottle-beta-${{ matrix.bottle_tag }}
path: "tracedecay-beta-*.bottle.tar.gz"
update-homebrew:
name: Update Homebrew tap (beta)
if: vars.BETA_CHANNEL_ENABLED == 'true' && needs.build.result == 'success'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version
id: version
run: |
VERSION="${RELEASE_TAG#v}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Download bottle artifacts
uses: actions/download-artifact@v4
with:
path: bottles
merge-multiple: true
- name: Upload bottles to release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for f in bottles/tracedecay-beta-*.bottle.tar.gz; do
gh release upload "$RELEASE_TAG" "$f" --clobber
done
- name: Download source tarball
run: |
curl -sL "https://github.com/${{ github.repository }}/archive/refs/tags/${RELEASE_TAG}.tar.gz" -o "source.tar.gz"
- name: Compute SHA256 hashes
id: hashes
run: |
VERSION="${{ steps.version.outputs.version }}"
SOURCE_SHA=$(sha256sum source.tar.gz | awk '{print $1}')
echo "source_sha=${SOURCE_SHA}" >> "$GITHUB_OUTPUT"
for f in bottles/tracedecay-beta-*.bottle.tar.gz; do
tag=$(basename "$f" | sed "s/tracedecay-beta-${VERSION}\.\(.*\)\.bottle\.tar\.gz/\1/")
sha=$(sha256sum "$f" | awk '{print $1}')
echo "${tag}_sha=${sha}" >> "$GITHUB_OUTPUT"
done
# NOTE: the Homebrew tap (ScriptedAlchemy/homebrew-tap) is an external
# repo — any previous beta formula there must be removed
# separately; this step only writes Formula/tracedecay-beta.rb.
- name: Update formula
env:
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.version }}"
SOURCE_SHA="${{ steps.hashes.outputs.source_sha }}"
ARM64_SONOMA_SHA="${{ steps.hashes.outputs.arm64_sonoma_sha }}"
X86_64_LINUX_SHA="${{ steps.hashes.outputs.x86_64_linux_sha }}"
git clone "https://x-access-token:${TAP_GITHUB_TOKEN}@github.com/ScriptedAlchemy/homebrew-tap.git" tap
cat > tap/Formula/tracedecay-beta.rb << EOF
class TracedecayBeta < Formula
desc "Code intelligence tool (beta channel)"
homepage "https://github.com/ScriptedAlchemy/tracedecay"
url "https://github.com/ScriptedAlchemy/tracedecay/archive/refs/tags/v${VERSION}.tar.gz"
sha256 "${SOURCE_SHA}"
license "MIT"
bottle do
root_url "https://github.com/ScriptedAlchemy/tracedecay/releases/download/v${VERSION}"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "${ARM64_SONOMA_SHA}"
sha256 cellar: :any_skip_relocation, x86_64_linux: "${X86_64_LINUX_SHA}"
end
depends_on "rust" => :build
conflicts_with "tracedecay", because: "both install a 'tracedecay' binary"
def install
system "cargo", "install", *std_cargo_args
end
test do
system "#{bin}/tracedecay", "--help"
end
end
EOF
cd tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/tracedecay-beta.rb
git diff --cached --quiet || git commit -m "tracedecay-beta ${VERSION}"
git push
update-scoop:
name: Update Scoop bucket (beta)
if: vars.BETA_CHANNEL_ENABLED == 'true' && needs.build.result == 'success'
needs: build
runs-on: ubuntu-latest
steps:
- name: Get release info
id: release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${RELEASE_TAG#v}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "tag=${RELEASE_TAG}" >> "$GITHUB_OUTPUT"
gh release download "${RELEASE_TAG}" \
--repo "${{ github.repository }}" \
--pattern "tracedecay-beta-${RELEASE_TAG}-x86_64-windows.zip" \
--dir .
SHA256=$(sha256sum "tracedecay-beta-${RELEASE_TAG}-x86_64-windows.zip" | cut -d' ' -f1)
echo "sha256_win64=${SHA256}" >> "$GITHUB_OUTPUT"
# NOTE: the Scoop bucket (ScriptedAlchemy/scoop-bucket) is an external
# repo — any previous beta bucket manifest there must be removed
# separately; this step only writes bucket/tracedecay-beta.json.
- name: Update Scoop manifest
env:
SCOOP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
run: |
VERSION="${{ steps.release.outputs.version }}"
TAG="${{ steps.release.outputs.tag }}"
SHA256="${{ steps.release.outputs.sha256_win64 }}"
cat > tracedecay-beta.json << EOF
{
"version": "${VERSION}",
"description": "Code intelligence tool (beta channel)",
"homepage": "https://github.com/ScriptedAlchemy/tracedecay",
"license": "MIT",
"architecture": {
"64bit": {
"url": "https://github.com/ScriptedAlchemy/tracedecay/releases/download/${TAG}/tracedecay-beta-${TAG}-x86_64-windows.zip",
"hash": "${SHA256}"
}
},
"bin": "tracedecay.exe",
"checkver": {
"github": "https://github.com/ScriptedAlchemy/tracedecay",
"regex": "v([\\d.]+-beta[\\d.]*)"
},
"autoupdate": {
"architecture": {
"64bit": {
"url": "https://github.com/ScriptedAlchemy/tracedecay/releases/download/v\$version/tracedecay-beta-v\$version-x86_64-windows.zip"
}
}
}
}
EOF
git clone "https://x-access-token:${SCOOP_GITHUB_TOKEN}@github.com/ScriptedAlchemy/scoop-bucket.git" scoop-repo
cd scoop-repo
mkdir -p bucket
cp ../tracedecay-beta.json bucket/tracedecay-beta.json
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add bucket/tracedecay-beta.json
git diff --cached --quiet || git commit -m "tracedecay-beta ${VERSION}"
git push