Skip to content

Commit 16f51cc

Browse files
authored
支持手动选择 Node 24/26 预发布版本及发布演练 (#4)
* 让 Node 24 预发布标题明确显示版本线和完整构建号 Signed-off-by: fogtape <lilixu3210@gmail.com> Assisted-by: Codex * ci: expose shared manual prerelease controls on the default line Add the same reviewed version planner and explicit Build prerelease inputs as the Node 26 line. The workflow-definition branch and source release line are separate, so Run workflow can select Node 24 or 26. PR/push builds do not publish; publication validates the exact version and requires the full gate chain. Node 24 source and compiler cache inputs remain unchanged. Signed-off-by: fogtape <lilixu3210@gmail.com> Assisted-by: Codex * ci: avoid git metadata cleanup races and preserve queued build caches Compare exported source instead of deleting git metadata while git maintenance can still write it. Opt this PR into preserve-build-cache queueing so replacing the verification run retains compiler progress. Source trees, release versions and completed-library keys are unchanged. Signed-off-by: fogtape <lilixu3210@gmail.com> Assisted-by: Codex --------- Signed-off-by: fogtape <lilixu3210@gmail.com>
1 parent 7db7a32 commit 16f51cc

8 files changed

Lines changed: 708 additions & 279 deletions

File tree

Lines changed: 14 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
11
name: Release check
22
description: >
3-
Decide whether the checked-out recipe commit should trigger publish: it checks
4-
whether the version of record (mobile-src/src/node_mobile_version.h) is
5-
already tagged, and whether this run is a rehearsal (`release-dryrun:` commit
6-
message).
7-
8-
This action is used by the build.yml `release-check` job, which gates the
9-
publish chain, and by the three compiling jobs (android-build, ios-build, and
10-
nodejs-mobile-build) to determine whether they must build cold (no shared
11-
cache) or may build warm (shared cache).`
12-
13-
Must run on the recipe checkout, BEFORE ./.github/actions/materialize
14-
replaces the workspace: mobile-src/ only exists on this branch.
15-
16-
Requires contents:read (tag probe).
3+
Validate explicit manual prerelease requests against the maintained branch,
4+
upstream pin, version header, reviewed release marker and unused tags.
5+
PR/push builds never publish. Run before materializing the recipe checkout.
176
inputs:
7+
operation:
8+
description: build, prerelease-dryrun or prerelease
9+
default: build
10+
version:
11+
description: Exact mobile version required for manual prerelease requests
12+
default: ''
1813
token:
1914
description: Token with contents:read on this repository, for the tag probe.
2015
required: true
2116
outputs:
2217
release:
23-
description: '"true" when this push should tag and publish.'
18+
description: '"true" for an explicit validated manual prerelease request.'
2419
value: ${{ steps.d.outputs.release }}
2520
dryrun:
26-
description: '"true" for a `release-dryrun:` rehearsal push.'
21+
description: '"true" for a validated manual prerelease-dryrun request.'
2722
value: ${{ steps.d.outputs.dryrun }}
2823
cold:
2924
description: >
@@ -41,44 +36,6 @@ runs:
4136
shell: bash
4237
env:
4338
GH_TOKEN: ${{ inputs.token }}
44-
run: |
45-
f=mobile-src/src/node_mobile_version.h
46-
if [ ! -f "$f" ]; then
47-
echo "::error::$f not found — the release-check action must run on the recipe checkout, before ./.github/actions/materialize"
48-
exit 1
49-
fi
50-
MA=$(grep -oE 'NODE_MOBILE_MAJOR_VERSION [0-9]+' "$f" | awk '{print $2}')
51-
MI=$(grep -oE 'NODE_MOBILE_MINOR_VERSION [0-9]+' "$f" | awk '{print $2}')
52-
PA=$(grep -oE 'NODE_MOBILE_PATCH_VERSION [0-9]+' "$f" | awk '{print $2}')
53-
RE=$(grep -oE 'NODE_MOBILE_REVISION [0-9]+' "$f" | awk '{print $2}')
54-
V="${MA}.${MI}.${PA}-${RE}"
55-
56-
DR=false
57-
REL=false
58-
# ONLY on a push to recipe — the sole path a release may take
59-
# (docs/RELEASING.md).
60-
if [ "$GITHUB_EVENT_NAME" = push ] && [ "$GITHUB_REF" = refs/heads/recipe ]; then
61-
case "$(git log -1 --format=%s)" in release-dryrun:*) DR=true ;; esac
62-
REL=true
63-
# Both the current tag scheme (vX.Y.Z-R) and the legacy one
64-
# (nodejs-mobile-X.Y.Z-R) count as released.
65-
for t in "v${V}" "nodejs-mobile-${V}"; do
66-
# Only a real 404 means "not tagged". A transient API failure must
67-
# not be read as absence — that would start a release run for an
68-
# already-released version.
69-
if out=$(gh api "repos/${GITHUB_REPOSITORY}/git/ref/tags/${t}" 2>&1); then
70-
echo "tag ${t} exists"
71-
REL=false
72-
elif ! printf '%s' "$out" | grep -q 'HTTP 404'; then
73-
echo "::error::tag probe for ${t} failed (not a 404): $out"
74-
exit 1
75-
fi
76-
done
77-
if [ "$DR" = true ]; then REL=false; fi
78-
fi
79-
80-
COLD=false
81-
if [ "$REL" = true ] || [ "$DR" = true ]; then COLD=true; fi
82-
83-
{ echo "version=$V"; echo "release=$REL"; echo "dryrun=$DR"; echo "cold=$COLD"; } >> "$GITHUB_OUTPUT"
84-
echo "version=$V release=$REL dryrun=$DR cold=$COLD"
39+
RELEASE_OPERATION: ${{ inputs.operation }}
40+
RELEASE_VERSION: ${{ inputs.version }}
41+
run: python3 scripts/release-control.py check

‎.github/workflows/build.yml‎

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Build
2+
run-name: ${{ github.event_name == 'workflow_dispatch' && format('{0} · {1} · {2}', inputs.operation, inputs.version || 'version of record', github.ref_name) || format('Build · {0}', github.head_ref || github.ref_name) }}
23

34
on:
45
# Don't run on pushes to PR branches to avoid double-running (push trigger and
@@ -11,13 +12,24 @@ on:
1112
pull_request:
1213
branches: [recipe]
1314
workflow_dispatch:
15+
inputs:
16+
operation:
17+
description: Build only, rehearse prerelease, or publish a prerelease
18+
type: choice
19+
options: [build, prerelease-dryrun, prerelease]
20+
default: build
21+
version:
22+
description: Exact mobile version for prerelease/dryrun (24.21.0-1); empty for build
23+
type: string
24+
default: ''
1425

1526
# One run per PR/branch. cancel-in-progress ONLY for pull_request: a push to
1627
# recipe may be carrying the release gate chain and must never be cancelled
1728
# mid-flight.
1829
concurrency:
1930
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
20-
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
31+
# Preserve an earlier compiler run when this review opts into cache retention.
32+
cancel-in-progress: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'preserve-build-cache') }}
2133

2234
# Shared compiler cache — security model in docs/BUILDING.md, "The CI
2335
# compiler cache". Summary: an sccache entry is never re-verified by the
@@ -26,7 +38,7 @@ concurrency:
2638
#
2739
# 1. The publish path builds COLD. Every compiling job asks
2840
# ./.github/actions/release-check whether this run is a release (or a
29-
# `release-dryrun:` rehearsal) and, if so, compiles with no sccache and
41+
# manual prerelease rehearsal) and, if so, compiles with no sccache and
3042
# no R2 credentials in scope — a poisoned cache object has no path to a
3143
# shipped artifact.
3244
# 2. Read and write are split by credential. `sccache-read` and
@@ -80,6 +92,7 @@ jobs:
8092
# on the merge run. Pushes and releases run both. See docs/TESTING.md,
8193
# "Flavors, and what's required to merge".
8294
build-android:
95+
needs: release-check
8396
strategy:
8497
fail-fast: false
8598
matrix:
@@ -122,6 +135,8 @@ jobs:
122135
uses: ./.github/actions/release-check
123136
with:
124137
token: ${{ github.token }}
138+
operation: ${{ inputs.operation || 'build' }}
139+
version: ${{ inputs.version || '' }}
125140

126141
- uses: ./.github/actions/materialize
127142

@@ -264,6 +279,7 @@ jobs:
264279
path: out_android
265280

266281
build-ios:
282+
needs: release-check
267283
strategy:
268284
fail-fast: false
269285
matrix:
@@ -295,6 +311,8 @@ jobs:
295311
uses: ./.github/actions/release-check
296312
with:
297313
token: ${{ github.token }}
314+
operation: ${{ inputs.operation || 'build' }}
315+
version: ${{ inputs.version || '' }}
298316

299317
- uses: ./.github/actions/materialize
300318

@@ -655,6 +673,7 @@ jobs:
655673
# Builds only the 'node' target, so no cctest/addons. Lives in this
656674
# workflow (not its own) so it can gate ci-required and publish via needs:.
657675
smoke-host:
676+
needs: release-check
658677
runs-on: ubuntu-24.04
659678
# See build-android. This job ships nothing, but it gates publish: a
660679
# poisoned host binary is a host binary that can be made to pass the tests
@@ -677,6 +696,8 @@ jobs:
677696
uses: ./.github/actions/release-check
678697
with:
679698
token: ${{ github.token }}
699+
operation: ${{ inputs.operation || 'build' }}
700+
version: ${{ inputs.version || '' }}
680701

681702
- uses: ./.github/actions/materialize
682703

@@ -853,6 +874,7 @@ jobs:
853874
ci-required:
854875
if: always()
855876
needs:
877+
- release-check
856878
- build-android
857879
- build-ios
858880
- combine-android
@@ -912,19 +934,9 @@ jobs:
912934
echo "upgrade=true" >> "$GITHUB_OUTPUT"
913935
fi
914936
915-
# Decide whether this push is a release, and publish that decision as job
916-
# outputs for the gate chain below. The decision itself — including the
917-
# push-to-recipe-only guard — lives in ./.github/actions/release-check,
918-
# because the compiling jobs above ask the same question for a different
919-
# reason (build cold) and must not depend on this job to get an answer.
920-
#
921-
# The job's own `if:` duplicates the guard inside the action on purpose:
922-
# skipping this job also skips the real-device smokes, the full suites and
923-
# publish, which need: it, so the gate chain never runs at all off a
924-
# non-release event. A deployment branch rule on the `release` Environment
925-
# restricting it to recipe would stop publish independently of this.
937+
# Validate explicit manual requests before compilation. Push/PR events
938+
# stay builds, including the merge of a release review PR.
926939
release-check:
927-
if: github.event_name == 'push' && github.ref == 'refs/heads/recipe'
928940
runs-on: ubuntu-24.04
929941
permissions:
930942
contents: read
@@ -940,6 +952,21 @@ jobs:
940952
uses: ./.github/actions/release-check
941953
with:
942954
token: ${{ github.token }}
955+
operation: ${{ inputs.operation || 'build' }}
956+
version: ${{ inputs.version || '' }}
957+
- name: Validate publishable notes before compiling
958+
if: steps.d.outputs.cold == 'true'
959+
env:
960+
V: ${{ steps.d.outputs.version }}
961+
run: scripts/release-notes.py --version "$V"
962+
- name: Show build or prerelease decision
963+
env:
964+
V: ${{ steps.d.outputs.version }}
965+
RELEASE: ${{ steps.d.outputs.release }}
966+
DRYRUN: ${{ steps.d.outputs.dryrun }}
967+
run: |
968+
printf '## Run plan\n\n- Version: `%s`\n- Publish prerelease: **%s**\n- Rehearsal: **%s**\n' \
969+
"$V" "$RELEASE" "$DRYRUN" >> "$GITHUB_STEP_SUMMARY"
943970
944971
# NOTE (this copy): the upstream recipe runs two BrowserStack real-device
945972
# smokes here (physical Android arm64 + iPhone) and publish needs: both.
@@ -988,10 +1015,8 @@ jobs:
9881015
# binary that cannot print hello on an emulator should not get four
9891016
# device-hours of suite first.
9901017
#
991-
# always() because release-check is push-only: on an upgrade PR it is
992-
# skipped, and a skipped job in needs: skips its dependents whatever their
993-
# `if:` says. always() drops that coupling, so the artifact/smoke gates the
994-
# skip used to provide have to be spelled out as result checks.
1018+
# always() plus explicit result checks prevent a failed artifact/smoke
1019+
# prerequisite from starting a device suite.
9951020
full-suite-android:
9961021
if: >-
9971022
always() &&
@@ -1149,17 +1174,19 @@ jobs:
11491174
EOF
11501175
exit 1
11511176
1152-
# Publish: on a release commit, once every gate in this run is green, tag
1177+
# Publish: on an explicit manual prerelease request, once every gate in this run is green, tag
11531178
# the materialized tree and publish the GitHub prerelease with this run's
11541179
# artifacts. All gating is needs:-based within one run -- no cross-run SHA
1155-
# lookups. A release-dryrun: commit exercises everything except the two
1180+
# lookups. A prerelease-dryrun dispatch exercises everything except the two
11561181
# mutating steps (tag push, release create).
11571182
publish:
11581183
if: >-
11591184
needs.release-check.outputs.release == 'true' ||
11601185
needs.release-check.outputs.dryrun == 'true'
11611186
needs:
11621187
- release-check
1188+
- ci-required
1189+
- release-notes
11631190
- smoke-android
11641191
- smoke-ios
11651192
- smoke-host
@@ -1254,6 +1281,7 @@ jobs:
12541281
- name: Create GitHub Release (prerelease)
12551282
run: |
12561283
TAG="v${V}"
1284+
RELEASE_TITLE="Node.js 24 LTS · nodejs-mobile v${V}(预发布)"
12571285
NOTES=$(cat "$RUNNER_TEMP/release-notes.md")
12581286
# Human-visible copy of the tag's Recipe-Commit trailer.
12591287
PROV="Generated from [\`recipe@${GITHUB_SHA:0:10}\`](https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA})."
@@ -1276,9 +1304,10 @@ jobs:
12761304
fi
12771305
gh release create "$TAG" out/*.zip \
12781306
--repo "$GITHUB_REPOSITORY" \
1279-
--title "nodejs-mobile ${V}" \
1307+
--title "$RELEASE_TITLE" \
12801308
--draft \
12811309
--prerelease \
1310+
--latest=false \
12821311
--notes "$BODY"
12831312
gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" --draft=false
12841313
echo "Published prerelease $TAG"

0 commit comments

Comments
 (0)