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
name: Release CLI npm package
# Publishing `@turndb/cli` and its platform packages: the crate's binary, delivered to people who
# install with npm rather than cargo. A merged Knope release PR or a deliberate manual dispatch
# supplies the exact annotated lockstep tag; the publish job stops at the protected `npm`
# environment for an owner's explicit act, exactly as the crate, native, and wasm releases do.
#
# The binary is built once from the exact-tag checkout, exercised by an install that drives it as a
# consumer would, and then published byte-identically. Both manifests are `private` in source and
# are cleared only by `pack-cli.cjs --release`, so a stray `npm publish` from a working tree
# refuses rather than shipping.
#
# Authentication is npm Trusted Publishing (OIDC): no long-lived registry token is stored here.
on:
workflow_call:
inputs:
release_ref:
required: true
type: string
workflow_dispatch:
inputs:
release_ref:
description: Exact annotated lockstep tag to release (vX.Y.Z)
required: true
type: string
concurrency:
group: release-cli-${{ inputs.release_ref }}
cancel-in-progress: false
jobs:
build:
name: build ${{ matrix.slice }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
strategy:
# No fail-fast: a slice that cannot build is worth seeing on its own rather than as a
# casualty of whichever sibling failed first.
fail-fast: false
matrix:
include:
# The reference slice, and the only one that also packs the selector and runs the
# licence check — both are platform-independent and doing them four times is waste.
- slice: linux-x64-gnu
target: x86_64-unknown-linux-gnu
runner: ubuntu-22.04
selector: '1'
# Built on arm64 hardware, not cross-compiled: the install matrix below drives it there.
- slice: linux-arm64-gnu
target: aarch64-unknown-linux-gnu
runner: ubuntu-22.04-arm
selector: '0'
# GitHub's explicit Intel and arm64 labels keep the architecture stable as
# macos-latest moves. Each builds natively on the toolchain that targets it.
- slice: darwin-x64
target: x86_64-apple-darwin
runner: macos-15-intel
selector: '0'
- slice: darwin-arm64
target: aarch64-apple-darwin
runner: macos-15
selector: '0'
- slice: win32-x64-msvc
target: x86_64-pc-windows-msvc
runner: windows-latest
selector: '0'
steps:
- uses: actions/checkout@v7
with:
ref: ${{ inputs.release_ref }}
fetch-depth: 0
# Match rust-toolchain.toml: installing a target on `stable` does not install it for the
# pinned toolchain that Cargo actually selects from the tagged checkout.
- uses: dtolnay/rust-toolchain@1.95.0
with:
targets: ${{ matrix.target }}
- uses: actions/setup-node@v4
with:
node-version: '24'
- name: verify exact release tag
shell: bash
env:
RELEASE_REF: ${{ inputs.release_ref }}
run: |
test "$(git describe --tags --exact-match HEAD)" = "$RELEASE_REF"
test "$(git cat-file -t "$RELEASE_REF")" = tag
case "$RELEASE_REF" in v[0-9]*.[0-9]*.[0-9]*) ;; *) exit 1 ;; esac
- name: verify lockstep package version matches the tag
shell: bash
env:
RELEASE_REF: ${{ inputs.release_ref }}
run: test "v$(node -p "require('./cli/package.json').version")" = "$RELEASE_REF"
- name: install pinned license-report generator
if: matrix.selector == '1'
run: cargo install cargo-about --version 0.9.1 --locked --features cli
- name: verify third-party licenses
if: matrix.selector == '1'
run: bash scripts/check-third-party-licenses.sh
- name: build the binary and pack this slice
env:
TURNDB_CLI_TARGET: ${{ matrix.target }}
TURNDB_CLI_SLICE: ${{ matrix.slice }}
TURNDB_CLI_PACK_SELECTOR: ${{ matrix.selector }}
run: node cli/scripts/pack-cli.cjs --release
# One artifact per slice, merged by the jobs downstream: matrix jobs writing one artifact
# name race each other for it.
- uses: actions/upload-artifact@v7
with:
name: turndb-cli-${{ inputs.release_ref }}-${{ matrix.slice }}
path: cli/dist/
if-no-files-found: error
retention-days: 7
# Every architecture that ships a binary drives it from an install before publish. Linux arm64
# was absent from this matrix through 0.1.8: its slice was published having never been run.
install:
name: install release candidate (${{ matrix.runner }}, node ${{ matrix.node }})
needs: build
runs-on: ${{ matrix.runner }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- node: '22'
runner: ubuntu-22.04
- node: '24'
runner: ubuntu-22.04
- node: '26'
runner: ubuntu-22.04
- node: '24'
runner: ubuntu-22.04-arm
- node: '24'
runner: windows-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ inputs.release_ref }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- uses: actions/download-artifact@v4
with:
pattern: turndb-cli-${{ inputs.release_ref }}-*
merge-multiple: true
path: cli/dist/
# Drives node_modules/.bin/turndb, not the built binary: the launcher resolving its platform
# package is the part most likely to be wrong, and only an install exercises it.
- name: install the exact tarballs and drive the CLI
run: node cli/scripts/test-cli.cjs cli/dist
publish:
name: publish to npm
needs:
runs-on: ubuntu-22.04
timeout-minutes: 15
environment: npm
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v7
with:
ref: ${{ inputs.release_ref }}
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '24'
- name: install trusted-publishing npm
run: npm install --global npm@11.5.1
- uses: actions/download-artifact@v4
with:
pattern: turndb-cli-${{ inputs.release_ref }}-*
merge-multiple: true
path: dist/
# Every required tarball and digest is checked before the first registry write. Every
# platform publishes before the selector; a missing OPTIONAL dependency otherwise looks like
# a successful npm install while leaving the launcher unable to resolve its binary.
- name: publish platform packages, then selector
run: node cli/scripts/publish-cli.cjs dist
env:
RELEASE_REF: ${{ inputs.release_ref }}
TURNDB_RELEASE_APPROVED: 'true'