11name : 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
34on :
45 # Don't run on pushes to PR branches to avoid double-running (push trigger and
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.
1829concurrency :
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
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