Skip to content

Commit e6347bb

Browse files
yamatatsuclaude
andcommitted
ci: migrate release to npm trusted publisher (OIDC)
- Add id-token: write permission for OIDC authentication - Remove NPM_TOKEN dependency (no longer needed) - Add --provenance flag to pnpm publish - Update npm to latest (v11.5.1+ required for OIDC) - Fix deprecated ::set-output → $GITHUB_OUTPUT - Replace unmaintained actions/create-release@v1 with gh release create - Update Node.js 18→22 and pnpm v8→v10 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2cef859 commit e6347bb

1 file changed

Lines changed: 17 additions & 35 deletions

File tree

.github/workflows/release.yml

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,61 +17,43 @@ jobs:
1717
runs-on: ubuntu-latest
1818
permissions:
1919
contents: write
20+
id-token: write
2021
steps:
2122
- name: Checkout
2223
uses: actions/checkout@v4
2324
- name: Setup Node
2425
uses: actions/setup-node@v4
2526
with:
26-
node-version: 18
27+
node-version: 22
2728
registry-url: "https://registry.npmjs.org"
28-
- uses: pnpm/action-setup@v2
29-
name: Install pnpm
30-
id: pnpm-install
29+
- name: Install pnpm
30+
uses: pnpm/action-setup@v2
3131
with:
32-
version: 8
32+
version: 10
3333
run_install: false
34+
- name: Update npm (required for OIDC trusted publishing)
35+
run: npm install -g npm@latest
3436
- run: pnpm install
3537
- run: pnpm test run
3638
- run: pnpm build
3739
- name: Configure git user
3840
run: |
3941
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
4042
git config user.name "github-actions[bot]"
41-
- name: Bump package.json version
43+
- name: Bump version
4244
id: bump
4345
run: |
4446
pnpm version ${{ github.event.inputs.bumpType }}
45-
echo "VERSION=v$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
47+
echo "VERSION=v$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
4648
git push
4749
git push --tag
48-
env:
49-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
- name: Release
50+
- name: Publish to npm
51+
run: pnpm publish --provenance --no-git-checks
52+
- name: Create GitHub Release
5153
run: |
52-
pnpm publish
54+
gh release create ${{ steps.bump.outputs.VERSION }} \
55+
--title "Release ${{ steps.bump.outputs.VERSION }}" \
56+
--generate-notes \
57+
--draft
5358
env:
54-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
55-
56-
- name: Get the version
57-
id: get_version
58-
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
59-
- name: Get commit summary
60-
id: get_commit_summary
61-
run: |
62-
PREVIOUS_TAG=$(git tag --sort=-creatordate | sed -n 2p)
63-
echo "PREVIOUS_TAG: $PREVIOUS_TAG"
64-
COMMIT_SUMMARY="$(git log --oneline --pretty=tformat:"%h %s" $PREVIOUS_TAG..${{ github.ref }})"
65-
COMMIT_SUMMARY="${COMMIT_SUMMARY//$'\n'/'%0A'}"
66-
echo ::set-output name=COMMIT_SUMMARY::$COMMIT_SUMMARY
67-
- name: Create Release
68-
uses: actions/create-release@v1
69-
env:
70-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71-
with:
72-
tag_name: ${{ steps.get_version.outputs.VERSION }}
73-
release_name: Release ${{ steps.get_version.outputs.VERSION }}
74-
body: |
75-
${{ steps.get_commit_summary.outputs.COMMIT_SUMMARY }}
76-
draft: true
77-
prerelease: true
59+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)