File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 release-type :
55 required : true
66 description : The type of release we are building. It could be nightly, release or dry-run
7- gha-npm-token :
8- required : false
9- description : The GHA npm token, required only to publish to npm
10- default : ' '
117 gradle-cache-encryption-key :
128 description : The encryption key needed to store the Gradle Configuration cache
139
3834 cache-encryption-key : ${{ inputs.gradle-cache-encryption-key }}
3935 - name : Setup node.js
4036 uses : ./.github/actions/setup-node
37+ with :
38+ node-version : ' 24'
39+ registry-url : ' https://registry.npmjs.org'
4140 - name : Install dependencies
4241 uses : ./.github/actions/yarn-install
4342 - name : Build packages
4645 - name : Build types
4746 shell : bash
4847 run : yarn build-types --skip-snapshot
49- # Continue with publish steps
50- - name : Set npm credentials
51- if : ${{ inputs.release-type == 'release' ||
52- inputs.release-type == 'nightly' }}
53- shell : bash
54- run : echo "//registry.npmjs.org/:_authToken=${{ inputs.gha-npm-token }}" > ~/.npmrc
48+ # `npm publish` below authenticates via npm Trusted Publishing (OIDC).
49+ # The caller (the `publish-npm.yml` workflow) MUST grant `id-token: write`;
50+ # this composite action runs inside that job.
5551 - name : Publish NPM
5652 shell : bash
5753 run : |
Original file line number Diff line number Diff line change @@ -5,11 +5,19 @@ inputs:
55 description : ' The node.js version to use'
66 required : false
77 default : ' 22.14.0'
8+ registry-url :
9+ description : |
10+ Optional npm registry URL passed through to actions/setup-node. Set on
11+ jobs that publish to npm so setup-node writes a `.npmrc` configured to
12+ pick up the OIDC-minted token from npm Trusted Publishing.
13+ required : false
14+ default : ' '
815runs :
9- using : " composite"
16+ using : ' composite'
1017 steps :
1118 - name : Setup node.js
1219 uses : actions/setup-node@v6
1320 with :
1421 node-version : ${{ inputs.node-version }}
1522 cache : yarn
23+ registry-url : ${{ inputs.registry-url }}
Original file line number Diff line number Diff line change 2828 token : ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
2929 fetch-depth : 0
3030 fetch-tags : ' true'
31- - name : Verify NPM token
32- run : |
33- if [[ -z "$GHA_NPM_TOKEN" ]]; then
34- echo "⚠️ No NPM token found. Skipping validation."
35- exit 0
36- fi
37- echo "//registry.npmjs.org/:_authToken=$GHA_NPM_TOKEN" > ~/.npmrc
38- if ! npm whoami > /dev/null 2>&1; then
39- echo "❌ NPM token is invalid or expired. Aborting release."
40- exit 1
41- fi
42- echo "✅ NPM token is valid ($(npm whoami))"
43- rm -f ~/.npmrc
44- env :
45- GHA_NPM_TOKEN : ${{ secrets.GHA_NPM_TOKEN }}
4631 - name : Check if on stable branch
4732 id : check_stable_branch
4833 run : |
Load diff This file was deleted.
Load diff This file was deleted.
You can’t perform that action at this time.
0 commit comments