Skip to content

Commit 85cb764

Browse files
dividedmindclaude
andcommitted
chore: migrate to npm trusted publishing and GitHub App token
- Replace PAT with GitHub App token (RELEASE_BOT_APP_ID/PRIVATE_KEY) in release job; app token events trigger other workflows unlike GITHUB_TOKEN - Remove npm publish from semantic-release; add separate publish.yml workflow triggered on version tags using OIDC (no NPM_TOKEN needed) - Drop id-token: write and write permissions from release job (governed by app installation, not workflow permissions block) - Add windows-test to release job dependencies - Remove @semantic-release/npm plugin from .releaserc.yaml Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5fde6c1 commit 85cb764

3 files changed

Lines changed: 31 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,22 @@ jobs:
5858

5959
release:
6060
runs-on: ubuntu-latest
61-
permissions:
62-
contents: write
63-
issues: write
64-
pull-requests: write
65-
id-token: write
61+
permissions: {}
6662
if: github.ref_name == 'main'
67-
needs: [lint, test]
63+
needs: [lint, test, windows-test]
6864
steps:
65+
- uses: actions/create-github-app-token@v1
66+
id: app-token
67+
with:
68+
app-id: ${{ secrets.RELEASE_BOT_APP_ID }}
69+
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
70+
repositories: ${{ github.event.repository.name }}
6971
- uses: actions/checkout@v4
7072
with:
7173
fetch-depth: 0
72-
token: ${{ secrets.SEMANTIC_RELEASE_BOT_GITHUB_TOKEN }}
74+
token: ${{ steps.app-token.outputs.token }}
7375
- uses: actions/setup-node@v4
7476
- run: yarn
75-
- run: yarn prepack
7677
- run: yarn semantic-release
77-
env:
78-
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_BOT_NPM_TOKEN }}
79-
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_BOT_GITHUB_TOKEN }}
78+
env:
79+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

.github/workflows/publish.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write
13+
contents: read
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
registry-url: 'https://registry.npmjs.org'
19+
- run: yarn
20+
- run: npm publish --provenance

.releaserc.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ plugins:
88
- "@semantic-release/commit-analyzer"
99
- "@semantic-release/release-notes-generator"
1010
- "@semantic-release/changelog"
11-
- "@semantic-release/npm"
1211
- "@semantic-release/git"
1312
- "@semantic-release/github"

0 commit comments

Comments
 (0)