-
Notifications
You must be signed in to change notification settings - Fork 204
657 lines (630 loc) · 26.9 KB
/
Copy pathpublish.yaml
File metadata and controls
657 lines (630 loc) · 26.9 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
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
# =============================================================================
# Publish
# =============================================================================
#
# Single workflow for preview publish AND release cuts. Both triggers are
# manual (workflow_dispatch). The build, npm publish, R2 upload, and Docker
# manifest steps run identically for both modes. Only the npm dist-tag,
# release-specific retagging, git tag, and GitHub release differ.
#
# Triggers and mapping:
# workflow_dispatch (no version) → trigger=branch npm_tag=<sanitized branch> build_mode=debug
# workflow_dispatch (with version) → trigger=release npm_tag=latest build_mode=release
# (npm_tag becomes `rc` if version contains `-rc.`, or
# `next` if `latest=false`)
#
# See ~/.agents/specs/publish-flow-unification.md for the design.
# ============================================================================
name: publish
on:
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g. 2.5.0 or 2.5.0-rc.1). Leave empty for preview publish on the dispatched branch."
required: false
type: string
latest:
description: "Tag as @latest (release only)"
required: true
type: boolean
default: true
env:
# Depot project ID (rivet-dev/rivet-engine).
DEPOT_PROJECT_ID: 1rcpv5rn8n
jobs:
# ---------------------------------------------------------------------------
# context — resolve PublishContext once, pin as job outputs
# ---------------------------------------------------------------------------
context:
name: "Context"
runs-on: ubuntu-24.04
outputs:
trigger: ${{ steps.ctx.outputs.trigger }}
version: ${{ steps.ctx.outputs.version }}
npm_tag: ${{ steps.ctx.outputs.npm_tag }}
sha: ${{ steps.ctx.outputs.sha }}
latest: ${{ steps.ctx.outputs.latest }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: pnpm
- name: Install publish scripts
run: pnpm install --frozen-lockfile --filter=publish
- id: ctx
name: Resolve publish context
run: pnpm --filter=publish exec tsx src/ci/bin.ts context-output
# ---------------------------------------------------------------------------
# build — matrix of native/engine artifacts
# ---------------------------------------------------------------------------
build:
needs: [context]
name: "Build ${{ matrix.name }}"
strategy:
fail-fast: false
matrix:
include:
# rivetkit-napi addon: 7 platforms (gnu + musl Linux, darwin,
# windows-msvc is produced via cargo-xwin in the base image).
- name: rivetkit-napi (linux-x64-gnu)
build_target: rivetkit-napi
docker: docker/build/linux-x64-gnu.Dockerfile
artifact: rivetkit-napi.linux-x64-gnu.node
upload_prefix: native
platform: linux-x64-gnu
release_only: false
- name: rivetkit-napi (linux-x64-musl)
build_target: rivetkit-napi
docker: docker/build/linux-x64-musl.Dockerfile
artifact: rivetkit-napi.linux-x64-musl.node
upload_prefix: native
platform: linux-x64-musl
release_only: false
- name: rivetkit-napi (linux-arm64-gnu)
build_target: rivetkit-napi
docker: docker/build/linux-arm64-gnu.Dockerfile
artifact: rivetkit-napi.linux-arm64-gnu.node
upload_prefix: native
platform: linux-arm64-gnu
release_only: false
- name: rivetkit-napi (linux-arm64-musl)
build_target: rivetkit-napi
docker: docker/build/linux-arm64-musl.Dockerfile
artifact: rivetkit-napi.linux-arm64-musl.node
upload_prefix: native
platform: linux-arm64-musl
release_only: false
- name: rivetkit-napi (darwin-x64)
build_target: rivetkit-napi
docker: docker/build/darwin-x64.Dockerfile
artifact: rivetkit-napi.darwin-x64.node
upload_prefix: native
platform: darwin-x64
release_only: false
- name: rivetkit-napi (darwin-arm64)
build_target: rivetkit-napi
docker: docker/build/darwin-arm64.Dockerfile
artifact: rivetkit-napi.darwin-arm64.node
upload_prefix: native
platform: darwin-arm64
release_only: false
# engine binary: 4 platforms for preview (musl, darwin), 5 for release
# (adds windows-x64). Windows is gated via release_only and skipped
# at the step level on preview triggers.
- name: engine (linux-x64-musl)
build_target: engine
docker: docker/build/linux-x64-musl.Dockerfile
artifact: rivet-engine-x86_64-unknown-linux-musl
upload_prefix: engine
platform: linux-x64-musl
release_only: false
- name: engine (linux-arm64-musl)
build_target: engine
docker: docker/build/linux-arm64-musl.Dockerfile
artifact: rivet-engine-aarch64-unknown-linux-musl
upload_prefix: engine
platform: linux-arm64-musl
release_only: false
- name: engine (darwin-x64)
build_target: engine
docker: docker/build/darwin-x64.Dockerfile
artifact: rivet-engine-x86_64-apple-darwin
upload_prefix: engine
platform: darwin-x64
release_only: false
- name: engine (darwin-arm64)
build_target: engine
docker: docker/build/darwin-arm64.Dockerfile
artifact: rivet-engine-aarch64-apple-darwin
upload_prefix: engine
platform: darwin-arm64
release_only: false
# Windows engine binary. Slow (~13 min due to MinGW ld). Only built
# on release triggers so preview publishes stay fast.
- name: engine (windows-x64)
build_target: engine
docker: docker/build/windows-x64.Dockerfile
artifact: rivet-engine-x86_64-pc-windows-gnu.exe
upload_prefix: engine
platform: windows-x64
release_only: true
# Container runner binary: static musl builds only. The runner only ever
# runs inside Linux containers, where users curl the released binary into
# their image.
- name: container-runner (linux-x64-musl)
build_target: container-runner
docker: docker/build/linux-x64-musl.Dockerfile
artifact: rivet-container-runner-x86_64-unknown-linux-musl
upload_prefix: container-runner
platform: linux-x64-musl
release_only: false
- name: container-runner (linux-arm64-musl)
build_target: container-runner
docker: docker/build/linux-arm64-musl.Dockerfile
artifact: rivet-container-runner-aarch64-unknown-linux-musl
upload_prefix: container-runner
platform: linux-arm64-musl
release_only: false
# Rivet Cloud CLI: 4 platforms for preview, 5 for release. The publish
# job also places the matching rivet-engine artifact next to the CLI
# binary so `rivet dev` works from the npm package.
- name: cli (linux-x64-musl)
build_target: cli
docker: docker/build/linux-x64-musl.Dockerfile
artifact: rivet-x86_64-unknown-linux-musl
upload_prefix: cli
platform: linux-x64-musl
release_only: false
- name: cli (linux-arm64-musl)
build_target: cli
docker: docker/build/linux-arm64-musl.Dockerfile
artifact: rivet-aarch64-unknown-linux-musl
upload_prefix: cli
platform: linux-arm64-musl
release_only: false
- name: cli (darwin-x64)
build_target: cli
docker: docker/build/darwin-x64.Dockerfile
artifact: rivet-x86_64-apple-darwin
upload_prefix: cli
platform: darwin-x64
release_only: false
- name: cli (darwin-arm64)
build_target: cli
docker: docker/build/darwin-arm64.Dockerfile
artifact: rivet-aarch64-apple-darwin
upload_prefix: cli
platform: darwin-arm64
release_only: false
- name: cli (windows-x64)
build_target: cli
docker: docker/build/windows-x64.Dockerfile
artifact: rivet-x86_64-pc-windows-gnu.exe
upload_prefix: cli
platform: windows-x64
release_only: true
runs-on: depot-ubuntu-24.04-8
permissions:
contents: read
id-token: write # required for depot OIDC trust
packages: read
steps:
- name: Skip release-only targets on non-release triggers
id: gate
run: |
if [ "${{ matrix.release_only }}" = "true" ] && [ "${{ needs.context.outputs.trigger }}" != "release" ]; then
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v4
if: steps.gate.outputs.skip != 'true'
with:
lfs: ${{ needs.context.outputs.trigger == 'release' }}
- uses: depot/setup-action@v1
if: steps.gate.outputs.skip != 'true'
- name: Log in to ghcr.io
if: steps.gate.outputs.skip != 'true'
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Compute build mode
if: steps.gate.outputs.skip != 'true'
id: mode
run: |
if [ "${{ needs.context.outputs.trigger }}" = "release" ]; then
echo "build_mode=release" >> $GITHUB_OUTPUT
else
echo "build_mode=debug" >> $GITHUB_OUTPUT
fi
- name: Build via depot
if: steps.gate.outputs.skip != 'true'
env:
DEPOT_TOKEN: ${{ secrets.DEPOT_TOKEN }}
run: |
depot build \
--project ${{ env.DEPOT_PROJECT_ID }} \
--secret id=DEPOT_TOKEN,env=DEPOT_TOKEN \
--build-arg BUILD_TARGET=${{ matrix.build_target }} \
--build-arg BUILD_MODE=${{ steps.mode.outputs.build_mode }} \
--build-arg BUILD_FRONTEND=${{ matrix.build_target == 'engine' && 'true' || 'false' }} \
-f ${{ matrix.docker }} \
-t builder-${{ matrix.build_target }}-${{ matrix.platform }} \
--load \
.
CONTAINER_ID=$(docker create builder-${{ matrix.build_target }}-${{ matrix.platform }})
mkdir -p artifacts
docker cp "$CONTAINER_ID:/artifacts/${{ matrix.artifact }}" artifacts/
docker rm "$CONTAINER_ID"
- name: Upload artifact
if: steps.gate.outputs.skip != 'true'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.upload_prefix }}-${{ matrix.platform }}
path: artifacts/${{ matrix.artifact }}
if-no-files-found: error
# ---------------------------------------------------------------------------
# build-wasm — disabled
# ---------------------------------------------------------------------------
# build-wasm:
# needs: [context]
# name: "Build rivetkit-wasm"
# runs-on: depot-ubuntu-24.04-8
# permissions:
# contents: read
# steps:
# - uses: actions/checkout@v4
# with:
# lfs: ${{ needs.context.outputs.trigger == 'release' }}
# - run: corepack enable
# - uses: actions/setup-node@v4
# with:
# node-version: "22"
# cache: pnpm
# - uses: actions-rust-lang/setup-rust-toolchain@v1
# with:
# toolchain: stable
# target: wasm32-unknown-unknown
# rustflags: ""
# - uses: Swatinem/rust-cache@v2
# with:
# shared-key: "rivetkit-wasm-publish"
# cache-on-failure: true
# - name: Install wasm package dependencies
# run: pnpm install --frozen-lockfile --filter=@rivetkit/rivetkit-wasm
# - name: Build wasm package
# run: pnpm --filter=@rivetkit/rivetkit-wasm build
# - name: Upload wasm package artifact
# uses: actions/upload-artifact@v4
# with:
# name: wasm-package
# path: rivetkit-typescript/packages/rivetkit-wasm/pkg
# if-no-files-found: error
# ---------------------------------------------------------------------------
# docker-images — per-arch runtime images pushed to Docker Hub
# ---------------------------------------------------------------------------
docker-images:
needs: [context]
name: "Docker ${{ matrix.arch_suffix }}"
strategy:
fail-fast: false
matrix:
include:
- platform: linux/arm64
runner: depot-ubuntu-24.04-arm-8
arch_suffix: -arm64
- platform: linux/x86_64
runner: depot-ubuntu-24.04-8
arch_suffix: -amd64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with:
lfs: ${{ needs.context.outputs.trigger == 'release' }}
- name: Compute build mode
id: mode
run: |
if [ "${{ needs.context.outputs.trigger }}" = "release" ]; then
echo "cargo_build_mode=release" >> $GITHUB_OUTPUT
echo "build_frontend=true" >> $GITHUB_OUTPUT
else
echo "cargo_build_mode=debug" >> $GITHUB_OUTPUT
echo "build_frontend=true" >> $GITHUB_OUTPUT
fi
- uses: ./.github/actions/docker-setup
with:
docker_username: ${{ secrets.DOCKER_CI_USERNAME }}
docker_password: ${{ secrets.DOCKER_CI_ACCESS_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Build & Push (rivetdev/engine:full)
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: rivetdev/engine:full-${{ needs.context.outputs.sha }}${{ matrix.arch_suffix }}
file: docker/engine/Dockerfile
target: engine-full
platforms: ${{ matrix.platform }}
build-args: |
BUILD_FRONTEND=${{ steps.mode.outputs.build_frontend }}
CARGO_BUILD_MODE=${{ steps.mode.outputs.cargo_build_mode }}
- name: Build & Push (rivetdev/engine:slim)
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: rivetdev/engine:slim-${{ needs.context.outputs.sha }}${{ matrix.arch_suffix }}
file: docker/engine/Dockerfile
target: engine-slim
platforms: ${{ matrix.platform }}
build-args: |
BUILD_FRONTEND=${{ steps.mode.outputs.build_frontend }}
CARGO_BUILD_MODE=${{ steps.mode.outputs.cargo_build_mode }}
# ---------------------------------------------------------------------------
# publish — npm publish + R2 upload + Docker manifest + release tail
# ---------------------------------------------------------------------------
publish:
needs: [context, build, docker-images]
name: "Publish"
if: |
!cancelled() &&
needs.build.result == 'success' &&
needs.docker-images.result == 'success'
runs-on: depot-ubuntu-24.04-8
permissions:
contents: write # git tag + gh release (release only)
id-token: write
pull-requests: write # PR comment
packages: read
steps:
- uses: actions/checkout@v4
with:
# Need history for tag operations in the release tail.
fetch-depth: 0
lfs: ${{ needs.context.outputs.trigger == 'release' }}
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: ./.github/actions/docker-setup
with:
docker_username: ${{ secrets.DOCKER_CI_USERNAME }}
docker_password: ${{ secrets.DOCKER_CI_ACCESS_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
# ---- download + place native + engine artifacts ----
- name: Download native artifacts
uses: actions/download-artifact@v4
with:
path: native-artifacts
pattern: native-*
merge-multiple: true
- name: Download engine artifacts
uses: actions/download-artifact@v4
with:
path: engine-artifacts
pattern: engine-*
merge-multiple: true
- name: Download CLI artifacts
uses: actions/download-artifact@v4
with:
path: cli-artifacts
pattern: cli-*
merge-multiple: true
- name: Download container runner artifacts
uses: actions/download-artifact@v4
with:
path: container-runner-artifacts
pattern: container-runner-*
merge-multiple: true
- name: Place native binaries in platform packages
run: |
NATIVE_DIR=rivetkit-typescript/packages/rivetkit-napi
for f in native-artifacts/*.node; do
filename=$(basename "$f")
platform="${filename#rivetkit-napi.}"
platform="${platform%.node}"
mkdir -p "${NATIVE_DIR}/npm/${platform}"
cp "$f" "${NATIVE_DIR}/npm/${platform}/"
echo "Placed $filename -> npm/${platform}/"
done
- name: Place engine binaries in engine-cli platform packages
run: |
ENGINE_CLI_DIR=rivetkit-typescript/packages/engine-cli/npm
declare -A TRIPLE_TO_PLATFORM=(
[rivet-engine-x86_64-unknown-linux-musl]=linux-x64-musl
[rivet-engine-aarch64-unknown-linux-musl]=linux-arm64-musl
[rivet-engine-x86_64-apple-darwin]=darwin-x64
[rivet-engine-aarch64-apple-darwin]=darwin-arm64
[rivet-engine-x86_64-pc-windows-gnu.exe]=win32-x64
)
for f in engine-artifacts/rivet-engine-*; do
[ -e "$f" ] || continue
filename=$(basename "$f")
platform="${TRIPLE_TO_PLATFORM[$filename]:-}"
if [ -z "$platform" ]; then
echo "Skipping engine artifact not mapped to a platform package: $filename"
continue
fi
dest="${ENGINE_CLI_DIR}/${platform}"
if [ ! -d "$dest" ]; then
echo "Missing engine-cli platform dir: $dest" >&2
exit 1
fi
if [ "$platform" = "win32-x64" ]; then
cp "$f" "$dest/rivet-engine.exe"
echo "Placed $filename -> npm/${platform}/rivet-engine.exe"
else
cp "$f" "$dest/rivet-engine"
chmod +x "$dest/rivet-engine"
echo "Placed $filename -> npm/${platform}/rivet-engine"
fi
done
- name: Place CLI binaries in CLI platform packages
run: |
CLI_DIR=rivetkit-typescript/packages/cli/npm
declare -A TRIPLE_TO_PLATFORM=(
[rivet-x86_64-unknown-linux-musl]=linux-x64-musl
[rivet-aarch64-unknown-linux-musl]=linux-arm64-musl
[rivet-x86_64-apple-darwin]=darwin-x64
[rivet-aarch64-apple-darwin]=darwin-arm64
[rivet-x86_64-pc-windows-gnu.exe]=win32-x64
)
for f in cli-artifacts/rivet-*; do
[ -e "$f" ] || continue
filename=$(basename "$f")
platform="${TRIPLE_TO_PLATFORM[$filename]:-}"
if [ -z "$platform" ]; then
echo "Skipping CLI artifact not mapped to a platform package: $filename"
continue
fi
dest="${CLI_DIR}/${platform}"
if [ ! -d "$dest" ]; then
echo "Missing CLI platform dir: $dest" >&2
exit 1
fi
if [ "$platform" = "win32-x64" ]; then
cp "$f" "$dest/rivet.exe"
echo "Placed $filename -> npm/${platform}/rivet.exe"
else
cp "$f" "$dest/rivet"
chmod +x "$dest/rivet"
echo "Placed $filename -> npm/${platform}/rivet"
fi
done
- name: Place bundled engine in CLI platform packages
run: |
CLI_DIR=rivetkit-typescript/packages/cli/npm
declare -A ENGINE_TO_PLATFORM=(
[rivet-engine-x86_64-unknown-linux-musl]=linux-x64-musl
[rivet-engine-aarch64-unknown-linux-musl]=linux-arm64-musl
[rivet-engine-x86_64-apple-darwin]=darwin-x64
[rivet-engine-aarch64-apple-darwin]=darwin-arm64
[rivet-engine-x86_64-pc-windows-gnu.exe]=win32-x64
)
for f in engine-artifacts/rivet-engine-*; do
[ -e "$f" ] || continue
filename=$(basename "$f")
platform="${ENGINE_TO_PLATFORM[$filename]:-}"
if [ -z "$platform" ]; then
echo "Skipping engine artifact not mapped to a CLI platform package: $filename"
continue
fi
dest="${CLI_DIR}/${platform}"
if [ ! -d "$dest" ]; then
echo "Missing CLI platform dir: $dest" >&2
exit 1
fi
if [ "$platform" = "win32-x64" ]; then
cp "$f" "$dest/rivet-engine.exe"
echo "Placed $filename -> npm/${platform}/rivet-engine.exe"
else
cp "$f" "$dest/rivet-engine"
chmod +x "$dest/rivet-engine"
echo "Placed $filename -> npm/${platform}/rivet-engine"
fi
done
- name: Bump package versions for build
run: |
pnpm --filter=publish exec tsx src/ci/bin.ts bump-versions \
--version ${{ needs.context.outputs.version }} \
--version-only
# ---- build TypeScript packages (turbo dep graph picks up native) ----
- name: Build TypeScript packages
env:
SKIP_WASM_BUILD: "1"
run: |
pnpm build -F rivetkit
pnpm build -F rivetkit -F '@rivetkit/*' -F '!@rivetkit/shared-data' -F '!@rivetkit/engine-frontend' -F '!@rivetkit/mcp-hub' -F '!@rivetkit/rivetkit-napi' -F '!@rivetkit/rivetkit-wasm'
# ---- shared publish (runs for all triggers) ----
- name: Finalize package versions for publish
run: pnpm --filter=publish exec tsx src/ci/bin.ts bump-versions --version ${{ needs.context.outputs.version }}
- name: Publish npm packages
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
pnpm --filter=publish exec tsx src/ci/bin.ts publish-npm \
--tag ${{ needs.context.outputs.npm_tag }} \
--parallel 16 \
--retries 3 \
${{ needs.context.outputs.trigger == 'release' && '--release-mode' || '' }}
- name: Upload engine binaries to R2
env:
R2_RELEASES_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
R2_RELEASES_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
run: pnpm --filter=publish exec tsx src/ci/bin.ts upload-r2 --source "$GITHUB_WORKSPACE/engine-artifacts" --sha ${{ needs.context.outputs.sha }}
- name: Upload container runner binaries to R2
env:
R2_RELEASES_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
R2_RELEASES_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
run: pnpm --filter=publish exec tsx src/ci/bin.ts upload-r2 --source "$GITHUB_WORKSPACE/container-runner-artifacts" --sha ${{ needs.context.outputs.sha }} --name container-runner
- name: Copy R2 artifacts to version path
if: needs.context.outputs.trigger == 'release'
env:
R2_RELEASES_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
R2_RELEASES_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
run: |
pnpm --filter=publish exec tsx src/ci/bin.ts copy-r2 \
--sha ${{ needs.context.outputs.sha }} \
--version ${{ needs.context.outputs.version }} \
--latest ${{ needs.context.outputs.latest }}
pnpm --filter=publish exec tsx src/ci/bin.ts copy-r2 \
--sha ${{ needs.context.outputs.sha }} \
--version ${{ needs.context.outputs.version }} \
--latest ${{ needs.context.outputs.latest }} \
--name container-runner
- name: Dry-run Rust crate publish
if: needs.context.outputs.trigger != 'release'
# Branch previews publish npm/R2/Docker artifacts only. Unlike npm,
# crates.io has no movable dist-tags, and every published preview
# version stays permanently visible, even if later yanked.
run: |
pnpm --filter=publish exec tsx src/ci/bin.ts publish-crates \
--version ${{ needs.context.outputs.version }} \
--dry-run \
--allow-dirty
- name: Publish Rust crates
if: needs.context.outputs.trigger == 'release'
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
pnpm --filter=publish exec tsx src/ci/bin.ts publish-crates \
--version ${{ needs.context.outputs.version }} \
--allow-dirty
- name: Create Docker multi-arch manifests
run: pnpm --filter=publish exec tsx src/ci/bin.ts docker-manifest --sha ${{ needs.context.outputs.sha }}
# ---- release-only tail ----
- name: Upload install scripts
if: needs.context.outputs.trigger == 'release'
env:
R2_RELEASES_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
R2_RELEASES_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
run: |
pnpm --filter=publish exec tsx src/ci/bin.ts upload-install-scripts \
--scripts-dir "$GITHUB_WORKSPACE/scripts/publish/static" \
--version ${{ needs.context.outputs.version }} \
--latest ${{ needs.context.outputs.latest }}
- name: Retag Docker manifests to version
if: needs.context.outputs.trigger == 'release'
run: |
pnpm --filter=publish exec tsx src/ci/bin.ts docker-retag \
--sha ${{ needs.context.outputs.sha }} \
--version ${{ needs.context.outputs.version }} \
--latest ${{ needs.context.outputs.latest }}
- name: Create git tag
if: needs.context.outputs.trigger == 'release'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
pnpm --filter=publish exec tsx src/ci/bin.ts git-tag --version ${{ needs.context.outputs.version }}
- name: Create GitHub release
if: needs.context.outputs.trigger == 'release'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm --filter=publish exec tsx src/ci/bin.ts gh-release --version ${{ needs.context.outputs.version }}