Skip to content

Commit 60fb009

Browse files
authored
Use OIDC for npm publish (#990)
<!-- CURSOR_SUMMARY --> > [!NOTE] > Move npm publishing to OIDC by adding id-token permissions and removing NPM_TOKEN, update actions/setup-node to v6, and upgrade npm in workflows. > > - **Workflows**: > - **OIDC for npm publish**: > - Add `permissions: id-token: write` in `workflows/publish_packages.yml` and `workflows/release.yml`. > - Remove `NPM_TOKEN` secret requirement and set `NPM_TOKEN: ""` in `changesets/action` env. > - **Node/tooling updates**: > - Bump `actions/setup-node` from `v3` to `v6` and set `registry-url` where needed. > - Add step to upgrade `npm` to `^11.6` in `publish_packages.yml`. > - Keep pnpm caching/configuration and other steps intact. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 539db59. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 0d8d0bc commit 60fb009

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

.github/workflows/publish_packages.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ on:
55
secrets:
66
E2B_API_KEY:
77
required: true
8-
NPM_TOKEN:
9-
required: true
108
PYPI_TOKEN:
119
required: true
1210

1311
permissions:
1412
contents: write
13+
id-token: write
1514

1615
jobs:
1716
test:
@@ -54,16 +53,22 @@ jobs:
5453
version: '${{ env.TOOL_VERSION_PNPM }}'
5554

5655
- name: Setup Node.js
57-
uses: actions/setup-node@v3
56+
uses: actions/setup-node@v6
5857
with:
5958
node-version: '${{ env.TOOL_VERSION_NODEJS }}'
59+
registry-url: 'https://registry.npmjs.org'
6060
cache: pnpm
6161

6262
- name: Configure pnpm
6363
run: |
6464
pnpm config set auto-install-peers true
6565
pnpm config set exclude-links-from-lockfile true
6666
67+
- name: Update npm
68+
run: |
69+
npm install -g npm@^11.6
70+
npm --version
71+
6772
- name: Install dependencies
6873
run: pnpm install --frozen-lockfile
6974

@@ -79,7 +84,7 @@ jobs:
7984
createGithubReleases: true
8085
env:
8186
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
87+
NPM_TOKEN: "" # See https://github.com/changesets/changesets/issues/1152#issuecomment-3190884868
8388
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
8489

8590
- name: Generate SDK reference

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
concurrency: ${{ github.workflow }}-${{ github.ref }}
77

88
permissions:
9+
id-token: write
910
contents: write
1011

1112
jobs:
@@ -32,7 +33,7 @@ jobs:
3233
version: '${{ env.TOOL_VERSION_PNPM }}'
3334

3435
- name: Setup Node
35-
uses: actions/setup-node@v3
36+
uses: actions/setup-node@v6
3637
with:
3738
node-version: '${{ env.TOOL_VERSION_NODEJS }}'
3839
registry-url: 'https://registry.npmjs.org'
@@ -80,7 +81,7 @@ jobs:
8081
version: '${{ env.TOOL_VERSION_PNPM }}'
8182

8283
- name: Setup Node
83-
uses: actions/setup-node@v3
84+
uses: actions/setup-node@v6
8485
with:
8586
node-version: '${{ env.TOOL_VERSION_NODEJS }}'
8687
registry-url: 'https://registry.npmjs.org'

0 commit comments

Comments
 (0)