Skip to content

Commit c37e2a5

Browse files
gnbmCopilot
andauthored
chore(npm): Update release npm action to stop using tokens (#30778)
Issue number: internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> - Release workflows still inject a long-lived `NPM_TOKEN` via `.npmrc`, so publishes do not use npm’s trusted OIDC flow. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - The shared `actions/publish-npm` composite action now configures `setup-node` with the npm registry, upgrades npm in place, and publishes with `--provenance` without writing `.npmrc`. - `release-dev.yml`, `release-nightly.yml`, and `release-production.yml` call into that trusted flow by removing the token input and (for production) inlining the same OIDC setup before `npm run release.ci`. - Allows npm to authenticate through trusted publishing requirements [docs.npmjs.com/trusted-publishers](https://docs.npmjs.com/trusted-publishers). - Step names were refreshed with emojis, but there are no other behavioral changes. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> - These changes align the Ionic release automation with npm’s trusted-publisher enforcement while keeping the existing Lerna build/publish process intact. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 0a02e0f commit c37e2a5

File tree

28 files changed

+160
-168
lines changed

28 files changed

+160
-168
lines changed

.github/workflows/actions/build-angular-server/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ description: 'Build Ionic Angular Server'
33
runs:
44
using: 'composite'
55
steps:
6-
- uses: actions/setup-node@v6
6+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
77
with:
88
node-version: 24.x
99
- uses: ./.github/workflows/actions/download-archive
1010
with:
1111
name: ionic-core
1212
path: ./core
1313
filename: CoreBuild.zip
14-
- name: Install Angular Server Dependencies
14+
- name: 🕸️ Install Angular Server Dependencies
1515
run: npm ci
1616
shell: bash
1717
working-directory: ./packages/angular-server
18-
- name: Sync
18+
- name: 🔄 Sync
1919
run: npm run sync
2020
shell: bash
2121
working-directory: ./packages/angular-server
22-
- name: Build
22+
- name: 🏗️ Build
2323
run: npm run build.prod
2424
shell: bash
2525
working-directory: ./packages/angular-server

.github/workflows/actions/build-angular/action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ runs:
1111
name: ionic-core
1212
path: ./core
1313
filename: CoreBuild.zip
14-
- name: Install Angular Dependencies
14+
- name: 🕸️ Install Angular Dependencies
1515
run: npm ci
1616
shell: bash
1717
working-directory: ./packages/angular
18-
- name: Sync
18+
- name: 🔄 Sync
1919
run: npm run sync
2020
shell: bash
2121
working-directory: ./packages/angular
22-
- name: Lint
22+
- name: 🖌️ Lint
2323
run: npm run lint
2424
shell: bash
2525
working-directory: ./packages/angular
26-
- name: Build
26+
- name: 🏗️ Build
2727
run: npm run build
2828
shell: bash
2929
working-directory: ./packages/angular
30-
- name: Check Diff
30+
- name: 🔍 Check Diff
3131
run: git diff --exit-code
3232
shell: bash
3333
working-directory: ./packages/angular

.github/workflows/actions/build-core-stencil-prerelease/action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ inputs:
88
runs:
99
using: 'composite'
1010
steps:
11-
- uses: actions/checkout@v5
12-
- uses: actions/setup-node@v6
11+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
12+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
1313
with:
1414
node-version: 24.x
1515

16-
- name: Install Dependencies
16+
- name: 🕸️ Install Dependencies
1717
run: npm ci
1818
working-directory: ./core
1919
shell: bash
20-
- name: Install Stencil ${{ inputs.stencil-version }}
20+
- name: 📦 Install Stencil ${{ inputs.stencil-version }}
2121
working-directory: ./core
2222
run: npm i @stencil/core@${{ inputs.stencil-version }}
2323
shell: bash
24-
- name: Build Core
24+
- name: 🏗️ Build Core
2525
run: npm run build -- --ci --debug --verbose
2626
working-directory: ./core
2727
shell: bash

.github/workflows/actions/build-core/action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ inputs:
88
runs:
99
using: 'composite'
1010
steps:
11-
- uses: actions/checkout@v5
12-
- uses: actions/setup-node@v6
11+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
12+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
1313
with:
1414
node-version: 24.x
15-
- name: Install Dependencies
15+
- name: 🕸️ Install Dependencies
1616
run: npm install
1717
working-directory: ./core
1818
shell: bash
1919
# If an Ionicons version was specified install that.
2020
# Otherwise just use the version defined in the package.json.
21-
- name: Install Ionicons Version
21+
- name: 📦 Install Ionicons Version
2222
if: inputs.ionicons-version != ''
2323
run: npm install ionicons@${{ inputs.ionicons-version }}
2424
working-directory: ./core
2525
shell: bash
26-
- name: Build Core
26+
- name: 🏗️ Build Core
2727
run: npm run build -- --ci
2828
working-directory: ./core
2929
shell: bash

.github/workflows/actions/build-react-router/action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: 'Build Ionic React Router'
33
runs:
44
using: 'composite'
55
steps:
6-
- uses: actions/setup-node@v6
6+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
77
with:
88
node-version: 24.x
99
- uses: ./.github/workflows/actions/download-archive
@@ -16,19 +16,19 @@ runs:
1616
name: ionic-react
1717
path: ./packages/react
1818
filename: ReactBuild.zip
19-
- name: Install Dependencies
19+
- name: 🕸️ Install Dependencies
2020
run: npm ci
2121
shell: bash
2222
working-directory: ./packages/react-router
23-
- name: Sync
23+
- name: 🔄 Sync
2424
run: npm run sync
2525
shell: bash
2626
working-directory: ./packages/react-router
27-
- name: Lint
27+
- name: 🖌️ Lint
2828
run: npm run lint
2929
shell: bash
3030
working-directory: ./packages/react-router
31-
- name: Build
31+
- name: 🏗️ Build
3232
run: npm run build
3333
shell: bash
3434
working-directory: ./packages/react-router

.github/workflows/actions/build-react/action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@ description: 'Build Ionic React'
33
runs:
44
using: 'composite'
55
steps:
6-
- uses: actions/setup-node@v6
6+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
77
with:
88
node-version: 24.x
99
- uses: ./.github/workflows/actions/download-archive
1010
with:
1111
name: ionic-core
1212
path: ./core
1313
filename: CoreBuild.zip
14-
- name: Install React Dependencies
14+
- name: 🕸️ Install React Dependencies
1515
run: npm ci
1616
shell: bash
1717
working-directory: ./packages/react
18-
- name: Sync
18+
- name: 🔄 Sync
1919
run: npm run sync
2020
shell: bash
2121
working-directory: ./packages/react
22-
- name: Lint
22+
- name: 🖌️ Lint
2323
run: npm run lint
2424
shell: bash
2525
working-directory: ./packages/react
26-
- name: Build
26+
- name: 🏗️ Build
2727
run: npm run build
2828
shell: bash
2929
working-directory: ./packages/react
30-
- name: Test Spec
30+
- name: 🧪 Test Spec
3131
run: npm run test.spec
3232
shell: bash
3333
working-directory: ./packages/react
34-
- name: Check Diff
34+
- name: 🔍 Check Diff
3535
run: git diff --exit-code
3636
shell: bash
3737
working-directory: ./packages/react

.github/workflows/actions/build-vue-router/action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: 'Builds Ionic Vue Router'
33
runs:
44
using: 'composite'
55
steps:
6-
- uses: actions/setup-node@v6
6+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
77
with:
88
node-version: 24.x
99
- uses: ./.github/workflows/actions/download-archive
@@ -16,23 +16,23 @@ runs:
1616
name: ionic-vue
1717
path: ./packages/vue
1818
filename: VueBuild.zip
19-
- name: Install Vue Router Dependencies
19+
- name: 🕸️ Install Vue Router Dependencies
2020
run: npm ci
2121
shell: bash
2222
working-directory: ./packages/vue-router
23-
- name: Sync
23+
- name: 🔄 Sync
2424
run: npm run sync
2525
shell: bash
2626
working-directory: ./packages/vue-router
27-
- name: Lint
27+
- name: 🖌️ Lint
2828
run: npm run lint
2929
shell: bash
3030
working-directory: ./packages/vue-router
31-
- name: Build
31+
- name: 🏗️ Build
3232
run: npm run build
3333
shell: bash
3434
working-directory: ./packages/vue-router
35-
- name: Test Spec
35+
- name: 🧪 Test Spec
3636
run: npm run test.spec
3737
shell: bash
3838
working-directory: ./packages/vue-router

.github/workflows/actions/build-vue/action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@ description: 'Build Ionic Vue'
33
runs:
44
using: 'composite'
55
steps:
6-
- uses: actions/setup-node@v6
6+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
77
with:
88
node-version: 24.x
99
- uses: ./.github/workflows/actions/download-archive
1010
with:
1111
name: ionic-core
1212
path: ./core
1313
filename: CoreBuild.zip
14-
- name: Install Vue Dependencies
14+
- name: 🕸️ Install Vue Dependencies
1515
run: npm ci
1616
shell: bash
1717
working-directory: ./packages/vue
18-
- name: Sync
18+
- name: 🔄 Sync
1919
run: npm run sync
2020
shell: bash
2121
working-directory: ./packages/vue
22-
- name: Lint
22+
- name: 🖌️ Lint
2323
run: npm run lint
2424
shell: bash
2525
working-directory: ./packages/vue
26-
- name: Build
26+
- name: 🏗️ Build
2727
run: npm run build
2828
shell: bash
2929
working-directory: ./packages/vue
30-
- name: Check Diff
30+
- name: 🔍 Check Diff
3131
run: git diff --exit-code
3232
shell: bash
3333
working-directory: ./packages/vue

.github/workflows/actions/download-archive/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ runs:
1414
with:
1515
name: ${{ inputs.name }}
1616
path: ${{ inputs.path }}
17-
- name: Extract Archive
17+
- name: 🔎 Extract Archive
1818
run: unzip -q -o ${{ inputs.path }}/${{ inputs.filename }}
1919
shell: bash

.github/workflows/actions/publish-npm/action.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,51 @@ inputs:
88
tag:
99
description: 'The tag to publish to on NPM.'
1010
preid:
11-
description: 'The prerelease identifier used when doing a prerelease.'
11+
description: "Prerelease identifier such as 'alpha', 'beta', 'rc', or 'next'. Leave blank to skip prerelease tagging."
1212
working-directory:
1313
description: 'The directory of the package.'
1414
folder:
1515
default: './'
1616
description: 'A folder containing a package.json file.'
17-
token:
18-
description: 'The NPM authentication token required to publish.'
17+
node-version:
18+
description: 'Node.js version to use when publishing.'
19+
required: false
20+
default: '24.x'
1921
runs:
2022
using: 'composite'
2123
steps:
22-
- uses: actions/setup-node@v6
24+
- name: 🟢 Configure Node for Publish
25+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
2326
with:
24-
node-version: 24.x
27+
node-version: ${{ inputs.node-version }}
28+
registry-url: 'https://registry.npmjs.org'
2529
# Provenance requires npm 9.5.0+
26-
- name: Install latest npm
30+
- name: 📦 Install latest npm
2731
run: npm install -g npm@latest
2832
shell: bash
2933
# This ensures the local version of Lerna is installed
3034
# and that we do not use the global Lerna version
31-
- name: Install root dependencies
35+
- name: 🕸️ Install root dependencies
3236
run: npm ci
3337
shell: bash
34-
- name: Install Dependencies
38+
- name: 📦 Install Dependencies
3539
run: npx lerna@5 bootstrap --include-dependencies --scope ${{ inputs.scope }} --ignore-scripts -- --legacy-peer-deps
3640
shell: bash
3741
working-directory: ${{ inputs.working-directory }}
38-
- name: Update Version
39-
run: npx lerna@5 version ${{ inputs.version }} --yes --exact --no-changelog --no-push --no-git-tag-version --preid=${{ inputs.preid }}
42+
- name: 🏷️ Set Version
43+
run: |
44+
if [ -z "${{ inputs.preid }}" ]; then
45+
npx lerna@5 version ${{ inputs.version }} --yes --exact --no-changelog --no-push --no-git-tag-version
46+
else
47+
npx lerna@5 version ${{ inputs.version }} --yes --exact --no-changelog --no-push --no-git-tag-version --preid=${{ inputs.preid }}
48+
fi
4049
shell: bash
4150
working-directory: ${{ inputs.working-directory }}
42-
- name: Run Build
51+
- name: 🏗️ Run Build
4352
run: npm run build
4453
shell: bash
4554
working-directory: ${{ inputs.working-directory }}
46-
- name: Prepare NPM Token
47-
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
48-
working-directory: ${{ inputs.working-directory }}
49-
shell: bash
50-
env:
51-
NPM_TOKEN: ${{ inputs.token }}
52-
- name: Publish to NPM
55+
- name: 🚀 Publish to NPM
5356
run: npm publish ${{ inputs.folder }} --tag ${{ inputs.tag }} --provenance
5457
shell: bash
5558
working-directory: ${{ inputs.working-directory }}

0 commit comments

Comments
 (0)