Skip to content

Commit bd38591

Browse files
authored
Quick Editor Release: Use Trusted Publishing instead of NPM Access Token (#256)
1. Add Repository URL NPM Provenance demands that the repository URL be the base URL of repo. Explicitly specify repository.directory to make it clear where the source lives. https://docs.npmjs.com/cli/v11/configuring-npm/package-json#repository 2. Removes NPM Access Token and switches release-it to use Trusted Publishing * https://docs.npmjs.com/trusted-publishers * https://github.com/release-it/release-it/blob/main/docs/npm.md#trusted-publishing-oidc
1 parent 2b40725 commit bd38591

3 files changed

Lines changed: 15 additions & 10 deletions

File tree

.github/workflows/quick-editor-release.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ jobs:
1717
runs-on: ubuntu-latest
1818
permissions:
1919
contents: write
20+
id-token: write # Required for NPM Trusted Publishing (OIDC)
2021

21-
steps:
22+
steps:
2223
- name: Checkout repo
2324
uses: actions/checkout@v4
2425
with:
@@ -30,23 +31,21 @@ jobs:
3031
with:
3132
node-version: '20'
3233
cache: 'npm'
34+
registry-url: 'https://registry.npmjs.org'
35+
36+
- name: Upgrade NPM
37+
run: npm install -g npm@latest
3338

3439
- name: Install dependencies
35-
run: npm install
40+
run: npm ci
3641

3742
- name: Initialize Git user
3843
run: |
3944
git config user.name "gravatar-automattic"
4045
git config user.email "gravatar@automattic.com"
4146
42-
- name: Initialize the NPM config
43-
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
44-
env:
45-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
46-
4747
- name: Release
4848
working-directory: web/packages/quick-editor
4949
run: npx release-it ${{ github.event.inputs.increment }} --ci
50-
env:
50+
env:
5151
GITHUB_TOKEN: ${{ secrets.GRAVATAR_GITHUB_TOKEN }}
52-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

web/packages/quick-editor/.release-it.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"assets": [ "release/quick-editor.zip" ]
1414
},
1515
"npm": {
16-
"publish": true
16+
"publish": true,
17+
"skipChecks": true
1718
},
1819
"hooks": {
1920
"before:init": [

web/packages/quick-editor/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@
6464
"engines": {
6565
"node": ">=20"
6666
},
67+
"repository": {
68+
"type": "git",
69+
"url": "git+https://github.com/Automattic/gravatar.git",
70+
"directory": "web/packages/quick-editor"
71+
},
6772
"publishConfig": {
6873
"access": "public"
6974
}

0 commit comments

Comments
 (0)