Repository navigation
594 lines (519 loc) · 21.8 KB
/
Copy pathrelease.yml
File metadata and controls
594 lines (519 loc) · 21.8 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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
name: Release
on:
workflow_call:
inputs:
tag:
description: 'Tag to release'
required: true
type: string
prerelease:
description: 'Mark as pre-release'
required: false
type: boolean
default: false
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g., v0.1.0)'
required: true
prerelease:
description: 'Mark as pre-release'
type: boolean
default: false
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# macOS
- target: x86_64-apple-darwin
os: macos-latest
archive: tar.gz
- target: aarch64-apple-darwin
os: macos-latest
archive: tar.gz
# Linux
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
archive: tar.gz
musl: true
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
cross: true
# Windows
- target: x86_64-pc-windows-msvc
os: windows-latest
archive: zip
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable branch, untagged
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.cross
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Install musl tools
if: matrix.musl
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Build rtk
run: cargo build --release --target ${{ matrix.target }}
env:
RTK_TELEMETRY_URL: ${{ vars.RTK_TELEMETRY_URL }}
RTK_TELEMETRY_TOKEN: ${{ secrets.RTK_TELEMETRY_TOKEN }}
- name: Package (Unix)
if: matrix.os != 'windows-latest'
run: |
# The binary links the BUSL-1.1 rtk-engine, so both texts travel
# with every artifact: LICENSE (Apache-2.0, the CLI sources) and
# LICENSE-ENGINE (BUSL-1.1, the linked engine).
cp LICENSE target/${{ matrix.target }}/release/LICENSE
cp engine/LICENSE target/${{ matrix.target }}/release/LICENSE-ENGINE
cd target/${{ matrix.target }}/release
tar -czvf ../../../rtk-${{ matrix.target }}.${{ matrix.archive }} rtk LICENSE LICENSE-ENGINE
cd ../../..
- name: Package (Windows)
if: matrix.os == 'windows-latest'
run: |
cp LICENSE target/${{ matrix.target }}/release/LICENSE
cp engine/LICENSE target/${{ matrix.target }}/release/LICENSE-ENGINE
cd target/${{ matrix.target }}/release
7z a ../../../rtk-${{ matrix.target }}.${{ matrix.archive }} rtk.exe LICENSE LICENSE-ENGINE
cd ../../..
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: rtk-${{ matrix.target }}
path: rtk-${{ matrix.target }}.${{ matrix.archive }}
# The Apache-2.0 edition: the same binary built without the BUSL engine,
# so only LICENSE travels with it. Same binary name `rtk` inside -- an
# installed hook command must keep working across editions.
- name: Build rtk (Apache-2.0 edition)
run: cargo build --release --no-default-features --target ${{ matrix.target }}
env:
RTK_TELEMETRY_URL: ${{ vars.RTK_TELEMETRY_URL }}
RTK_TELEMETRY_TOKEN: ${{ secrets.RTK_TELEMETRY_TOKEN }}
- name: Package rtk-oss (Unix)
if: matrix.os != 'windows-latest'
run: |
cp LICENSE target/${{ matrix.target }}/release/LICENSE
cd target/${{ matrix.target }}/release
tar -czvf ../../../rtk-oss-${{ matrix.target }}.${{ matrix.archive }} rtk LICENSE
cd ../../..
- name: Package rtk-oss (Windows)
if: matrix.os == 'windows-latest'
run: |
cp LICENSE target/${{ matrix.target }}/release/LICENSE
cd target/${{ matrix.target }}/release
7z a ../../../rtk-oss-${{ matrix.target }}.${{ matrix.archive }} rtk.exe LICENSE
cd ../../..
- name: Upload rtk-oss artifact
uses: actions/upload-artifact@v4
with:
name: rtk-oss-${{ matrix.target }}
path: rtk-oss-${{ matrix.target }}.${{ matrix.archive }}
# The daemon ships as its own archive rather than inside the rtk one.
# It is licensed BUSL-1.1, not Apache-2.0, so bundling it would hand
# every rtk user a binary under different terms without them choosing
# it. The BSL requires its text to travel with the work, hence the
# LICENSE alongside the binary, plus LICENSE-ENGINE for the rtk-engine
# crate the daemon links.
#
# `--target-dir target` keeps the output where the packaging steps look:
# proxy/ is not a workspace member, so its default target dir would be
# proxy/target/.
- name: Build rtk-proxy
id: build_proxy
run: >
cargo build --release
--manifest-path proxy/Cargo.toml
--target-dir target
--target ${{ matrix.target }}
env:
CFLAGS_x86_64_unknown_linux_musl: "-Du_int8_t=uint8_t -Du_int16_t=uint16_t -Du_int64_t=uint64_t"
- name: Package rtk-proxy (Unix)
if: matrix.os != 'windows-latest'
run: |
cp proxy/LICENSE target/${{ matrix.target }}/release/LICENSE
cp engine/LICENSE target/${{ matrix.target }}/release/LICENSE-ENGINE
cd target/${{ matrix.target }}/release
tar -czvf ../../../rtk-proxy-${{ matrix.target }}.${{ matrix.archive }} rtk-proxy LICENSE LICENSE-ENGINE
cd ../../..
- name: Package rtk-proxy (Windows)
if: matrix.os == 'windows-latest'
run: |
cp proxy/LICENSE target/${{ matrix.target }}/release/LICENSE
cp engine/LICENSE target/${{ matrix.target }}/release/LICENSE-ENGINE
cd target/${{ matrix.target }}/release
7z a ../../../rtk-proxy-${{ matrix.target }}.${{ matrix.archive }} rtk-proxy.exe LICENSE LICENSE-ENGINE
cd ../../..
- name: Upload rtk-proxy artifact
uses: actions/upload-artifact@v4
with:
name: rtk-proxy-${{ matrix.target }}
path: rtk-proxy-${{ matrix.target }}.${{ matrix.archive }}
build-deb:
name: Build DEB package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable branch, untagged
- name: Install cargo-deb
run: cargo install cargo-deb
- name: Build DEB
run: cargo deb
env:
RTK_TELEMETRY_URL: ${{ vars.RTK_TELEMETRY_URL }}
RTK_TELEMETRY_TOKEN: ${{ secrets.RTK_TELEMETRY_TOKEN }}
- name: Upload DEB
uses: actions/upload-artifact@v7
with:
name: rtk-deb
path: target/debian/*.deb
build-deb-oss:
name: Build DEB package (Apache-2.0 edition)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-deb
run: cargo install cargo-deb
- name: Build DEB
run: cargo deb --variant oss -- --no-default-features
env:
RTK_TELEMETRY_URL: ${{ vars.RTK_TELEMETRY_URL }}
RTK_TELEMETRY_TOKEN: ${{ secrets.RTK_TELEMETRY_TOKEN }}
- name: Upload DEB
uses: actions/upload-artifact@v4
with:
name: rtk-oss-deb
path: target/debian/*.deb
build-rpm-oss:
name: Build RPM package (Apache-2.0 edition)
runs-on: ubuntu-latest
container: fedora:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
dnf install -y rust cargo rpm-build
- name: Install cargo-generate-rpm
run: cargo install cargo-generate-rpm
- name: Build release
run: cargo build --release --no-default-features
env:
RTK_TELEMETRY_URL: ${{ vars.RTK_TELEMETRY_URL }}
RTK_TELEMETRY_TOKEN: ${{ secrets.RTK_TELEMETRY_TOKEN }}
- name: Generate RPM
run: cargo generate-rpm --variant oss
- name: Upload RPM
uses: actions/upload-artifact@v4
with:
name: rtk-oss-rpm
path: target/generate-rpm/*.rpm
build-rpm:
name: Build RPM package
runs-on: ubuntu-latest
container: fedora:latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install dependencies
run: |
dnf install -y rust cargo rpm-build
- name: Install cargo-generate-rpm
run: cargo install cargo-generate-rpm
- name: Build release
run: cargo build --release
env:
RTK_TELEMETRY_URL: ${{ vars.RTK_TELEMETRY_URL }}
RTK_TELEMETRY_TOKEN: ${{ secrets.RTK_TELEMETRY_TOKEN }}
- name: Generate RPM
run: cargo generate-rpm
- name: Upload RPM
uses: actions/upload-artifact@v7
with:
name: rtk-rpm
path: target/generate-rpm/*.rpm
release:
name: Create Release
needs: [build, build-deb, build-rpm, build-deb-oss, build-rpm-oss]
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: app-token
with:
client-id: ${{ secrets.APP_CLIENT_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
permission-contents: write
- name: Checkout
uses: actions/checkout@v7
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Get version
id: version
env:
INPUT_TAG: ${{ inputs.tag }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
TAG="$INPUT_TAG"
if [ -z "$TAG" ]; then
TAG="$RELEASE_TAG"
fi
echo "version=$TAG" >> $GITHUB_OUTPUT
- name: Flatten artifacts
run: |
mkdir -p release
find artifacts -type f \( -name "*.tar.gz" -o -name "*.zip" -o -name "*.deb" -o -name "*.rpm" \) -exec cp {} release/ \;
# Stable download names. Match each edition explicitly: a bare *.deb
# glob would copy both editions over one name and drop the other.
- name: Create version-agnostic package names
run: |
cd release
for f in rtk_*.deb; do [ -f "$f" ] && cp "$f" "rtk_amd64.deb"; done
for f in rtk-oss_*.deb; do [ -f "$f" ] && cp "$f" "rtk-oss_amd64.deb"; done
for f in rtk-[0-9]*.rpm; do [ -f "$f" ] && cp "$f" "rtk.x86_64.rpm"; done
for f in rtk-oss-[0-9]*.rpm; do [ -f "$f" ] && cp "$f" "rtk-oss.x86_64.rpm"; done
- name: Create checksums
run: |
cd release
sha256sum * > checksums.txt
- name: Upload Release Assets
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
with:
tag_name: ${{ steps.version.outputs.version }}
files: release/*
prerelease: ${{ inputs.prerelease }}
token: ${{ steps.app-token.outputs.token }}
notify-discord:
name: Notify Discord
needs: [release]
if: ${{ !inputs.prerelease }}
runs-on: ubuntu-latest
steps:
- name: Get version
id: version
env:
INPUT_TAG: ${{ inputs.tag }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
TAG="$INPUT_TAG"
if [ -z "$TAG" ]; then
TAG="$RELEASE_TAG"
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Send Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.RTK_DISCORD_RELEASE }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ steps.version.outputs.tag }}"
RELEASE_URL="https://github.com/rtk-ai/rtk/releases/tag/${TAG}"
# Fetch release notes from GitHub API
NOTES=$(gh api "repos/rtk-ai/rtk/releases/tags/${TAG}" --jq '.body' 2>/dev/null | head -c 1800 || echo "")
DESC=$(echo "${NOTES:-No release notes}" | jq -Rs .)
jq -n \
--arg title "RTK ${TAG} released" \
--arg url "$RELEASE_URL" \
--argjson desc "$DESC" \
'{embeds: [{title: $title, url: $url, description: $desc, color: 5814783, footer: {text: "Rust Token Killer"}}]}' \
| curl -sf -H "Content-Type: application/json" -d @- "$DISCORD_WEBHOOK"
homebrew:
name: Update Homebrew formula
needs: [release]
if: ${{ !inputs.prerelease }}
runs-on: ubuntu-latest
steps:
- name: Get version
id: version
env:
INPUT_TAG: ${{ inputs.tag }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
TAG="$INPUT_TAG"
if [ -z "$TAG" ]; then
TAG="$RELEASE_TAG"
fi
VERSION="${TAG#v}"
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Download checksums
run: |
gh release download "${{ steps.version.outputs.tag }}" \
--repo rtk-ai/rtk \
--pattern checksums.txt
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Parse checksums
id: sha
run: |
echo "mac_arm=$(grep "[[:space:]]rtk-aarch64-apple-darwin.tar.gz\$" checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "mac_intel=$(grep "[[:space:]]rtk-x86_64-apple-darwin.tar.gz\$" checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "linux_arm=$(grep "[[:space:]]rtk-aarch64-unknown-linux-gnu.tar.gz\$" checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "linux_intel=$(grep "[[:space:]]rtk-x86_64-unknown-linux-musl.tar.gz\$" checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "oss_mac_arm=$(grep "[[:space:]]rtk-oss-aarch64-apple-darwin.tar.gz\$" checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "oss_mac_intel=$(grep "[[:space:]]rtk-oss-x86_64-apple-darwin.tar.gz\$" checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "oss_linux_arm=$(grep "[[:space:]]rtk-oss-aarch64-unknown-linux-gnu.tar.gz\$" checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "oss_linux_intel=$(grep "[[:space:]]rtk-oss-x86_64-unknown-linux-musl.tar.gz\$" checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
- name: Generate formula
run: |
cat > rtk.rb << 'FORMULA'
class Rtk < Formula
desc "Rust Token Killer - High-performance CLI proxy to minimize LLM token consumption"
homepage "https://www.rtk-ai.app"
version "VERSION_PLACEHOLDER"
license all_of: ["Apache-2.0", "BUSL-1.1"]
conflicts_with "rtk-oss", because: "both install the rtk binary"
if OS.mac? && Hardware::CPU.arm?
url "https://github.com/rtk-ai/rtk/releases/download/TAG_PLACEHOLDER/rtk-aarch64-apple-darwin.tar.gz"
sha256 "SHA_MAC_ARM_PLACEHOLDER"
elsif OS.mac? && Hardware::CPU.intel?
url "https://github.com/rtk-ai/rtk/releases/download/TAG_PLACEHOLDER/rtk-x86_64-apple-darwin.tar.gz"
sha256 "SHA_MAC_INTEL_PLACEHOLDER"
elsif OS.linux? && Hardware::CPU.arm?
url "https://github.com/rtk-ai/rtk/releases/download/TAG_PLACEHOLDER/rtk-aarch64-unknown-linux-gnu.tar.gz"
sha256 "SHA_LINUX_ARM_PLACEHOLDER"
elsif OS.linux? && Hardware::CPU.intel?
url "https://github.com/rtk-ai/rtk/releases/download/TAG_PLACEHOLDER/rtk-x86_64-unknown-linux-musl.tar.gz"
sha256 "SHA_LINUX_INTEL_PLACEHOLDER"
end
def install
bin.install "rtk"
end
def caveats
<<~EOS
rtk is installed! Get started:
# Initialize for Claude Code
rtk init -g # Global hook-first setup (recommended)
rtk init # Add to ./CLAUDE.md (this project only)
# See all commands
rtk --help
# Measure your token savings
rtk gain
Full documentation: https://www.rtk-ai.app
EOS
end
test do
system "#{bin}/rtk", "--version"
end
end
FORMULA
sed -i "s/VERSION_PLACEHOLDER/${{ steps.version.outputs.version }}/g" rtk.rb
sed -i "s/TAG_PLACEHOLDER/${{ steps.version.outputs.tag }}/g" rtk.rb
sed -i "s/SHA_MAC_ARM_PLACEHOLDER/${{ steps.sha.outputs.mac_arm }}/g" rtk.rb
sed -i "s/SHA_MAC_INTEL_PLACEHOLDER/${{ steps.sha.outputs.mac_intel }}/g" rtk.rb
sed -i "s/SHA_LINUX_ARM_PLACEHOLDER/${{ steps.sha.outputs.linux_arm }}/g" rtk.rb
sed -i "s/SHA_LINUX_INTEL_PLACEHOLDER/${{ steps.sha.outputs.linux_intel }}/g" rtk.rb
# Remove leading spaces from heredoc
sed -i 's/^ //' rtk.rb
# Second formula for the Apache-2.0 edition. Class name RtkOss maps to
# Formula/rtk-oss.rb, installed as `brew install rtk-ai/tap/rtk-oss`.
# It provides the same `rtk` binary, so it conflicts with the full one.
- name: Generate formula (Apache-2.0 edition)
run: |
cat > rtk-oss.rb << 'FORMULA'
class RtkOss < Formula
desc "Rust Token Killer - Apache-2.0 edition: hook rewrite and command filters"
homepage "https://www.rtk-ai.app"
version "VERSION_PLACEHOLDER"
license "Apache-2.0"
conflicts_with "rtk", because: "both install the rtk binary"
if OS.mac? && Hardware::CPU.arm?
url "https://github.com/rtk-ai/rtk/releases/download/TAG_PLACEHOLDER/rtk-oss-aarch64-apple-darwin.tar.gz"
sha256 "SHA_OSS_MAC_ARM_PLACEHOLDER"
elsif OS.mac? && Hardware::CPU.intel?
url "https://github.com/rtk-ai/rtk/releases/download/TAG_PLACEHOLDER/rtk-oss-x86_64-apple-darwin.tar.gz"
sha256 "SHA_OSS_MAC_INTEL_PLACEHOLDER"
elsif OS.linux? && Hardware::CPU.arm?
url "https://github.com/rtk-ai/rtk/releases/download/TAG_PLACEHOLDER/rtk-oss-aarch64-unknown-linux-gnu.tar.gz"
sha256 "SHA_OSS_LINUX_ARM_PLACEHOLDER"
elsif OS.linux? && Hardware::CPU.intel?
url "https://github.com/rtk-ai/rtk/releases/download/TAG_PLACEHOLDER/rtk-oss-x86_64-unknown-linux-musl.tar.gz"
sha256 "SHA_OSS_LINUX_INTEL_PLACEHOLDER"
end
def install
bin.install "rtk"
end
test do
system "#{bin}/rtk", "--version"
end
end
FORMULA
sed -i "s/VERSION_PLACEHOLDER/${{ steps.version.outputs.version }}/g" rtk-oss.rb
sed -i "s/TAG_PLACEHOLDER/${{ steps.version.outputs.tag }}/g" rtk-oss.rb
sed -i "s/SHA_OSS_MAC_ARM_PLACEHOLDER/${{ steps.sha.outputs.oss_mac_arm }}/g" rtk-oss.rb
sed -i "s/SHA_OSS_MAC_INTEL_PLACEHOLDER/${{ steps.sha.outputs.oss_mac_intel }}/g" rtk-oss.rb
sed -i "s/SHA_OSS_LINUX_ARM_PLACEHOLDER/${{ steps.sha.outputs.oss_linux_arm }}/g" rtk-oss.rb
sed -i "s/SHA_OSS_LINUX_INTEL_PLACEHOLDER/${{ steps.sha.outputs.oss_linux_intel }}/g" rtk-oss.rb
sed -i 's/^ //' rtk-oss.rb
- name: Push to homebrew-tap
run: |
for f in rtk rtk-oss; do
CONTENT=$(base64 -w 0 "$f.rb")
SHA=$(gh api "repos/rtk-ai/homebrew-tap/contents/Formula/$f.rb" --jq '.sha' 2>/dev/null || echo "")
if [ -n "$SHA" ]; then
gh api -X PUT "repos/rtk-ai/homebrew-tap/contents/Formula/$f.rb" \
-f message="$f ${{ steps.version.outputs.version }}" \
-f content="$CONTENT" \
-f sha="$SHA"
else
gh api -X PUT "repos/rtk-ai/homebrew-tap/contents/Formula/$f.rb" \
-f message="$f ${{ steps.version.outputs.version }}" \
-f content="$CONTENT"
fi
done
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
winget:
name: Update winget manifest
needs: [release]
if: ${{ !inputs.prerelease }}
runs-on: ubuntu-latest
# A failed submission must not fail the release workflow: cd.yml gates
# update-latest-tag on build-release, so a red job here would leave the
# 'latest' tag on the previous version.
continue-on-error: true
steps:
- name: Get version
id: version
env:
INPUT_TAG: ${{ inputs.tag }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
TAG="$INPUT_TAG"
if [ -z "$TAG" ]; then
TAG="$RELEASE_TAG"
fi
VERSION="${TAG#v}"
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
# Pinned to a main commit, not the v2 tag: v2 has not moved since 2024-11-27
# and is four fixes behind, including cargo binstall on ubuntu-slim runners.
- uses: vedantmgoyal9/winget-releaser@a43926ed822e5a076ac8a81e0a794915cbad51d1 # 2026-03-14
with:
identifier: rtk-ai.rtk
version: ${{ steps.version.outputs.version }}
installers-regex: 'rtk-x86_64-pc-windows-msvc\.zip$'
token: ${{ secrets.WINGET_TOKEN }}
release-tag: ${{ steps.version.outputs.tag }}