Skip to content

Commit 5e90396

Browse files
feat(ci): migrate to OIDC Trusted Publishing
- Upgrade Node to v24 for built-in npm 11.x OIDC support - SHA-pin GitHub Actions to prevent tag hijacking - Add registry-url for OIDC token configuration - Remove NPM_TOKEN dependency, use OIDC authentication - Add skipChecks to release-it (OIDC doesn't support npm whoami) - Add --ignore-scripts protection for dependency installation
1 parent 0a832ef commit 5e90396

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

.github/actions/prepare/action.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ name: Prepare
55
runs:
66
steps:
77
- name: Install pnpm
8-
uses: pnpm/action-setup@v4
9-
with:
10-
version: 10
8+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
119
- name: Use Node.js
12-
uses: actions/setup-node@v4
10+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
1311
with:
14-
node-version: '22'
15-
cache: 'pnpm'
12+
node-version: '24'
13+
registry-url: 'https://registry.npmjs.org'
1614
- name: Install dependencies
17-
run: pnpm install
15+
run: pnpm install --frozen-lockfile --ignore-scripts
1816
shell: bash
1917
using: composite

.github/workflows/release.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
permissions:
99
contents: write
10-
id-token: write
10+
id-token: write # Required for OIDC Trusted Publishing
1111

1212
concurrency:
1313
cancel-in-progress: true
@@ -17,20 +17,21 @@ jobs:
1717
release:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v3
20+
# SHA-pinned actions (prevent tag hijacking)
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2122
with:
2223
fetch-depth: 0
2324
- uses: ./.github/actions/prepare
2425
- run: git config user.name "${{ github.actor }}"
2526
- run: git config user.email "${{ github.actor }}@users.noreply.github.com"
27+
28+
# Release with OIDC (NO NPM_TOKEN needed)
29+
# ⚠️ Do NOT set NODE_AUTH_TOKEN - OIDC handles auth automatically
2630
- env:
27-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
28-
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
29-
- env:
30-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3132
# Check if the latest commit message contains a release tag pattern (e.g., "release v1.2.3")
3233
# If found, execute release-it without version increment since version was already bumped in the commit
3334
run: |
3435
if git log --format=%B -n 1 | grep -E -q 'release v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'; then
35-
pnpm release-it --no-increment --verbose
36+
pnpm release-it --no-increment --verbose
3637
fi

.release-it.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"releaseNotes": "git log --no-merges --pretty=format:\"* %s %h\" ${latestTag}...main | grep -v 'release v[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}'\n"
1212
},
1313
"npm": {
14-
"publishArgs": ["--provenance"]
14+
"publish": true,
15+
"skipChecks": true
1516
}
1617
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"git-gpt": "./index.js"
3838
},
3939
"volta": {
40-
"node": "22.18.0"
40+
"node": "24.13.0"
4141
},
4242
"devDependencies": {
4343
"@laststance/npm-publish-tool": "^1.6.9",

0 commit comments

Comments
 (0)