Skip to content

Commit beea72a

Browse files
authored
chore: rely on OIDC when publishing to npm (#2710)
## Description Drop reliance on an NPM token and use **OIDC** instead for publishing SDKs by configuring **trusted publishers**. ## References * [https://docs.npmjs.com/trusted-publishers](https://docs.npmjs.com/trusted-publishers) ## Testing * This change adds test coverage for new, changed, or fixed functionality. ## Checklist * [ ] I have added documentation for new or changed functionality in this PR or on **auth0.com/docs** * [ ] All active GitHub checks for tests, formatting, and security are passing * [ ] The correct base branch is being used (if not the default branch)
1 parent 00124da commit beea72a

File tree

5 files changed

+14
-37
lines changed

5 files changed

+14
-37
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: Publish release to npm
33
inputs:
44
node-version:
55
required: true
6-
npm-token:
7-
required: true
86
version:
97
required: true
108
require-build:
@@ -26,6 +24,10 @@ runs:
2624
cache: 'npm'
2725
registry-url: 'https://registry.npmjs.org'
2826

27+
- name: Update npm
28+
shell: bash
29+
run: npm install -g npm@11
30+
2931
- name: Install dependencies
3032
if: inputs.require-build == 'true'
3133
shell: bash
@@ -47,7 +49,6 @@ runs:
4749
else
4850
TAG="latest"
4951
fi
50-
npm publish --provenance --tag $TAG
52+
npm publish --tag $TAG
5153
env:
52-
NODE_AUTH_TOKEN: ${{ inputs.npm-token }}
5354
VERSION: ${{ inputs.version }}

.github/workflows/npm-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ on:
1515
secrets:
1616
github-token:
1717
required: true
18-
npm-token:
19-
required: true
2018

2119
### TODO: Replace instances of './.github/actions/' w/ `auth0/dx-sdk-actions/` and append `@latest` after the common `dx-sdk-actions` repo is made public.
2220
### TODO: Also remove `get-prerelease`, `get-version`, `release-create`, `tag-create` and `tag-exists` actions from this repo's .github/actions folder once the repo is public.
@@ -26,6 +24,9 @@ jobs:
2624
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/'))
2725
runs-on: ubuntu-latest
2826
environment: release
27+
permissions:
28+
contents: write
29+
id-token: write
2930

3031
steps:
3132
# Checkout the code
@@ -70,7 +71,6 @@ jobs:
7071
require-build: ${{ inputs.require-build }}
7172
release-directory: ${{ inputs.release-directory }}
7273
version: ${{ steps.get_version.outputs.version }}
73-
npm-token: ${{ secrets.npm-token }}
7474

7575
# Create a release for the tag
7676
- uses: ./.github/actions/release-create

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@ jobs:
2121
node-version: 18
2222
require-build: true
2323
secrets:
24-
npm-token: ${{ secrets.NPM_TOKEN }}
2524
github-token: ${{ secrets.GITHUB_TOKEN }}

package-lock.json

Lines changed: 5 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
"jsonp": "^0.2.1",
129129
"password-sheriff": "^1.1.1",
130130
"prop-types": "^15.8.0",
131-
"qs": "^6.10.3",
131+
"qs": "^6.14.1",
132132
"react": "^18.2.0",
133133
"react-dom": "^18.2.0",
134134
"react-transition-group": "^4.4.5",

0 commit comments

Comments
 (0)