Skip to content

Commit d1a3dda

Browse files
MantisCloneCopilot
andauthored
chore: add OIDC Trusted Publisher for NPM (#345)
Co-authored-by: Copilot <[email protected]>
1 parent 8d7177d commit d1a3dda

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

.github/workflows/npm-publish.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
- main
99
workflow_dispatch:
1010

11+
permissions:
12+
id-token: write # Required for OIDC
13+
contents: read
14+
1115
jobs:
1216
release-if-necessary:
1317
runs-on: ubuntu-latest
@@ -26,11 +30,15 @@ jobs:
2630
fetch-depth: 0
2731

2832
- name: Set up Node.js
29-
uses: actions/setup-node@v3
33+
uses: actions/setup-node@v4
3034
with:
31-
node-version: '18'
35+
node-version: '20'
3236
registry-url: 'https://registry.npmjs.org'
3337

38+
# Ensure npm 11.5.1 or later is installed
39+
- name: Update npm
40+
run: npm install -g npm@latest
41+
3442
- name: Install dependencies 📥
3543
run: npm ci
3644

@@ -49,12 +57,10 @@ jobs:
4957
if: steps.check-release.outputs.release-type == 'stable'
5058
run: npm publish --workspace=${{ matrix.package }}
5159
env:
52-
NODE_AUTH_TOKEN: ${{ secrets.REQUEST_BOT_NPM_TOKEN }}
5360
VITE_WEB3MODAL_PROJECT_ID: ${{ secrets.VITE_WEB3MODAL_PROJECT_ID }}
5461

5562
- name: Publish next version 📦
5663
if: steps.check-release.outputs.release-type == 'next'
5764
run: npm run publish-next-release --workspace=${{ matrix.package }}
5865
env:
59-
NODE_AUTH_TOKEN: ${{ secrets.REQUEST_BOT_NPM_TOKEN }}
6066
VITE_WEB3MODAL_PROJECT_ID: ${{ secrets.VITE_WEB3MODAL_PROJECT_ID }}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ Each component has its own version number. The versioning scheme we use is
3333

3434
1. Increase the version number of a given component by running `npm version <major|minor|patch>` inside the package directory or by using the `--workspace=<package>` flag from the root directory.
3535
2. Create a PR.
36-
3. When the PR is merged, the CI will automatically publish the new version to NPM.
36+
3. When the PR is merged, the CI will automatically publish the new version to NPM using OIDC Trusted Publisher authentication (no manual tokens required).

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Run changeset version command to bump the version of the packages that have chan
8888
npx changeset version
8989
```
9090

91-
Push the changes to the remote repository. Once the changes are merged, the new versions will be deployed automatically.
91+
Push the changes to the remote repository. Once the changes are merged, the new versions will be deployed automatically using OIDC Trusted Publisher authentication.
9292

93-
For more info about workinng with NPM workspaces see:
93+
For more info about working with NPM workspaces see:
9494
https://docs.npmjs.com/cli/v8/using-npm/workspaces

0 commit comments

Comments
 (0)