Skip to content

Commit dafd058

Browse files
committed
fix: use OIDC npm releases
1 parent 2d7d762 commit dafd058

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

.github/workflows/ltpr.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ name: Lint, Test, Publish and Release
33
permissions:
44
checks: write
55
contents: write
6+
id-token: write # Required for npm OIDC Trusted Publishing
67

78
on:
89
push:
910
tags:
10-
- 'v*'
11+
- "v*"
1112

1213
jobs:
1314
lint:
@@ -21,9 +22,9 @@ jobs:
2122
- name: Setup Node.js
2223
uses: actions/setup-node@v4
2324
with:
24-
node-version: 'lts/*'
25-
registry-url: 'https://registry.npmjs.org'
26-
cache: 'pnpm'
25+
node-version: "lts/*"
26+
registry-url: "https://registry.npmjs.org"
27+
cache: "pnpm"
2728

2829
- name: Install dependencies
2930
run: pnpm install --frozen-lockfile
@@ -55,8 +56,8 @@ jobs:
5556
- name: Setup Node.js
5657
uses: actions/setup-node@v4
5758
with:
58-
node-version: 'lts/*'
59-
cache: 'pnpm'
59+
node-version: "lts/*"
60+
cache: "pnpm"
6061

6162
- name: Install dependencies
6263
run: pnpm install --frozen-lockfile
@@ -92,8 +93,8 @@ jobs:
9293
- name: Setup Node.js
9394
uses: actions/setup-node@v4
9495
with:
95-
node-version: 'lts/*'
96-
cache: 'pnpm'
96+
node-version: "lts/*"
97+
cache: "pnpm"
9798

9899
- name: Install dependencies
99100
run: pnpm install --frozen-lockfile
@@ -120,6 +121,9 @@ jobs:
120121
publish:
121122
runs-on: ubuntu-latest
122123
needs: [lint, test, build]
124+
permissions:
125+
contents: write
126+
id-token: write # Required for npm OIDC Trusted Publishing
123127
steps:
124128
- uses: actions/checkout@v4
125129
with:
@@ -136,25 +140,27 @@ jobs:
136140
- name: Setup Node.js
137141
uses: actions/setup-node@v4
138142
with:
139-
node-version: 'lts/*'
140-
registry-url: 'https://registry.npmjs.org'
141-
cache: 'pnpm'
143+
node-version: "lts/*"
144+
registry-url: "https://registry.npmjs.org"
145+
cache: "pnpm"
142146

143147
- name: Install dependencies
144148
run: pnpm install --frozen-lockfile
145149

146150
- name: Run dev:prepare
147151
run: pnpm dev:prepare
148152

149-
- name: Publish to npm
153+
# npm Trusted Publishing uses OIDC - no token needed!
154+
# Configure trusted publisher at: https://www.npmjs.com/package/nuxt-tiptap-editor/access
155+
- name: Publish to npm (OIDC Trusted Publishing)
150156
shell: bash
151157
if: success()
152-
run: pnpm publish --access public --no-git-checks
158+
run: pnpm publish --access public --no-git-checks --provenance
153159
env:
154-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
160+
NPM_CONFIG_PROVENANCE: true
155161

156162
- name: Create GitHub Release
157163
if: success()
158164
run: npx --yes changelogithub@latest
159165
env:
160-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
166+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)