1919 - stable
2020 - nightly
2121 version :
22- description : " Release version (for example 1.2.3 or v1.2.3) "
22+ description : " Stable version override (for example 1.2.3). Defaults to the version the latest nightly previewed. "
2323 required : false
2424 type : string
2525
@@ -39,33 +39,54 @@ permissions:
3939 id-token : none
4040
4141jobs :
42- check_changes :
43- name : Check automatic nightly release
44- if : github.event_name == 'schedule'
42+ # Picks the commit every later job builds. Nightlies and tag pushes build the
43+ # triggering commit. Manual stable releases build the commit of the latest
44+ # published nightly, so stable only ever ships a build that nightly users
45+ # have already run. Scheduled runs also decide here whether a nightly is due.
46+ resolve_commit :
47+ name : Resolve release commit
4548 runs-on : blacksmith-8vcpu-ubuntu-2404
4649 timeout-minutes : 5
4750 outputs :
48- has_changes : ${{ steps.check.outputs.result }}
51+ ref : ${{ steps.resolve.outputs.ref }}
52+ nightly_version : ${{ steps.resolve.outputs.nightly_version }}
53+ has_changes : ${{ steps.resolve.outputs.has_changes }}
4954 steps :
5055 - name : Checkout
5156 uses : actions/checkout@v6
5257 with :
5358 sparse-checkout : .github/scripts
5459
55- - id : check
56- name : Check release gap and new commits
60+ - id : resolve
61+ name : Resolve release commit
5762 uses : actions/github-script@v8
63+ env :
64+ DISPATCH_CHANNEL : ${{ inputs.channel }}
5865 with :
5966 script : |
60- const { shouldReleaseNightly } = require('./.github/scripts/check-nightly-release.cjs');
61- return await shouldReleaseNightly({ github, context, core });
67+ const {
68+ shouldReleaseNightly,
69+ resolveLatestNightlyCommit,
70+ } = require('./.github/scripts/check-nightly-release.cjs');
71+
72+ if (context.eventName === 'schedule') {
73+ core.setOutput('has_changes', await shouldReleaseNightly({ github, context, core }));
74+ core.setOutput('ref', context.sha);
75+ } else if (context.eventName === 'workflow_dispatch' && process.env.DISPATCH_CHANNEL !== 'nightly') {
76+ const { tag, sha, version } = await resolveLatestNightlyCommit({ github, context, core });
77+ core.notice(`Stable release builds ${sha}, the commit shipped by ${tag}.`);
78+ core.setOutput('ref', sha);
79+ core.setOutput('nightly_version', version);
80+ } else {
81+ core.setOutput('ref', context.sha);
82+ }
6283
6384 preflight :
6485 name : Preflight
65- needs : [check_changes ]
86+ needs : [resolve_commit ]
6687 if : |
67- !failure() && !cancelled() &&
68- (github.event_name != 'schedule' || needs.check_changes .outputs.has_changes == 'true')
88+ needs.resolve_commit.result == 'success' &&
89+ (github.event_name != 'schedule' || needs.resolve_commit .outputs.has_changes == 'true')
6990 runs-on : blacksmith-8vcpu-ubuntu-2404
7091 timeout-minutes : 10
7192 outputs :
@@ -78,11 +99,12 @@ jobs:
7899 cli_dist_tag : ${{ steps.release_meta.outputs.cli_dist_tag }}
79100 is_prerelease : ${{ steps.release_meta.outputs.is_prerelease }}
80101 make_latest : ${{ steps.release_meta.outputs.make_latest }}
81- ref : ${{ github.sha }}
102+ ref : ${{ needs.resolve_commit.outputs.ref }}
82103 steps :
83104 - name : Checkout
84105 uses : actions/checkout@v6
85106 with :
107+ ref : ${{ needs.resolve_commit.outputs.ref }}
86108 fetch-depth : 0
87109 sparse-checkout : |
88110 /*
@@ -104,8 +126,9 @@ jobs:
104126 env :
105127 DISPATCH_CHANNEL : ${{ github.event.inputs.channel }}
106128 DISPATCH_VERSION : ${{ github.event.inputs.version }}
129+ NIGHTLY_VERSION : ${{ needs.resolve_commit.outputs.nightly_version }}
107130 NIGHTLY_DATE : ${{ github.run_started_at }}
108- NIGHTLY_SHA : ${{ github.sha }}
131+ NIGHTLY_SHA : ${{ needs.resolve_commit.outputs.ref }}
109132 NIGHTLY_RUN_NUMBER : ${{ github.run_number }}
110133 run : |
111134 if [[ "${GITHUB_EVENT_NAME}" == "schedule" || ( "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${DISPATCH_CHANNEL:-stable}" == "nightly" ) ]]; then
@@ -123,9 +146,9 @@ jobs:
123146 echo "make_latest=false" >> "$GITHUB_OUTPUT"
124147 else
125148 if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
126- raw="${DISPATCH_VERSION}"
149+ raw="${DISPATCH_VERSION:-$NIGHTLY_VERSION }"
127150 if [[ -z "$raw" ]]; then
128- echo "workflow_dispatch stable releases require the version input." >&2
151+ echo "workflow_dispatch stable releases need a version input or a published nightly ." >&2
129152 exit 1
130153 fi
131154 else
@@ -210,14 +233,12 @@ jobs:
210233
211234 relay_public_config :
212235 name : Resolve T3 Connect public config
213- # Consumes only the commit SHA, not preflight's resolved version, so it runs
214- # alongside preflight instead of after it. The condition mirrors preflight's:
215- # check_changes is skipped on manual and tag releases (skipped is neither failure
216- # nor success, so success() would be wrong here).
217- needs : [check_changes]
236+ # Consumes only the release commit, not preflight's resolved version, so it
237+ # runs alongside preflight instead of after it. The condition mirrors preflight's.
238+ needs : [resolve_commit]
218239 if : |
219- !failure() && !cancelled() &&
220- (github.event_name != 'schedule' || needs.check_changes .outputs.has_changes == 'true')
240+ needs.resolve_commit.result == 'success' &&
241+ (github.event_name != 'schedule' || needs.resolve_commit .outputs.has_changes == 'true')
221242 runs-on : blacksmith-8vcpu-ubuntu-2404
222243 timeout-minutes : 5
223244 environment :
@@ -239,7 +260,7 @@ jobs:
239260 - name : Checkout
240261 uses : actions/checkout@v6
241262 with :
242- ref : ${{ github.sha }}
263+ ref : ${{ needs.resolve_commit.outputs.ref }}
243264 sparse-checkout : |
244265 /*
245266 !/.repos/
@@ -312,19 +333,19 @@ jobs:
312333 # machine. node-pty is N-API, so one binary works across all WSL Node versions.
313334 build_wsl_node_pty :
314335 name : Build WSL node-pty (linux-x64)
315- # Same gating as relay_public_config: only the commit SHA is needed, so this
316- # runs alongside preflight. See the condition comment there.
317- needs : [check_changes ]
336+ # Same gating as relay_public_config: only the release commit is needed, so
337+ # this runs alongside preflight. See the condition comment there.
338+ needs : [resolve_commit ]
318339 if : |
319- !failure() && !cancelled() &&
320- (github.event_name != 'schedule' || needs.check_changes .outputs.has_changes == 'true')
340+ needs.resolve_commit.result == 'success' &&
341+ (github.event_name != 'schedule' || needs.resolve_commit .outputs.has_changes == 'true')
321342 runs-on : blacksmith-8vcpu-ubuntu-2404
322343 timeout-minutes : 15
323344 steps :
324345 - name : Checkout
325346 uses : actions/checkout@v6
326347 with :
327- ref : ${{ github.sha }}
348+ ref : ${{ needs.resolve_commit.outputs.ref }}
328349 sparse-checkout : |
329350 /*
330351 !/.repos/
@@ -1036,6 +1057,60 @@ jobs:
10361057 "${vercel_scope_args[@]}"
10371058 fi
10381059
1060+ deploy_marketing :
1061+ name : Deploy marketing site
1062+ needs : [preflight, release]
1063+ if : ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'nightly' }}
1064+ runs-on : blacksmith-8vcpu-ubuntu-2404
1065+ timeout-minutes : 10
1066+ env :
1067+ VERCEL_TOKEN : ${{ secrets.VERCEL_TOKEN }}
1068+ VERCEL_ORG_ID : ${{ secrets.VERCEL_ORG_ID }}
1069+ VERCEL_TEAM_SLUG : ${{ vars.VERCEL_TEAM_SLUG }}
1070+ steps :
1071+ - name : Checkout
1072+ uses : actions/checkout@v6
1073+ with :
1074+ ref : ${{ needs.preflight.outputs.ref }}
1075+ sparse-checkout : |
1076+ /*
1077+ !/.repos/
1078+ sparse-checkout-cone-mode : false
1079+
1080+ - name : Setup Vite+
1081+ uses : voidzero-dev/setup-vp@v1
1082+ with :
1083+ node-version-file : package.json
1084+ cache : true
1085+ run-install : |
1086+ args:
1087+ - --filter=@t3tools/marketing...
1088+
1089+ - name : Deploy marketing site to Vercel
1090+ shell : bash
1091+ run : |
1092+ set -euo pipefail
1093+
1094+ if [[ -z "${VERCEL_TOKEN:-}" || -z "${VERCEL_ORG_ID:-}" ]]; then
1095+ echo "Missing one or more required Vercel secrets: VERCEL_TOKEN, VERCEL_ORG_ID." >&2
1096+ exit 1
1097+ fi
1098+
1099+ VERCEL_PROJECT_ID="$(
1100+ curl --fail --silent --show-error \
1101+ --header "Authorization: Bearer $VERCEL_TOKEN" \
1102+ "https://api.vercel.com/v9/projects/t3code-marketing?teamId=$VERCEL_ORG_ID" \
1103+ | jq --exit-status --raw-output '.id'
1104+ )"
1105+ export VERCEL_PROJECT_ID
1106+
1107+ 1108+ --archive=tgz \
1109+ --prod \
1110+ --yes \
1111+ --token "$VERCEL_TOKEN" \
1112+ --scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
1113+
10391114 finalize :
10401115 name : Finalize release
10411116 if : ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel == 'stable' }}
0 commit comments