Skip to content

Commit cb67c1f

Browse files
committed
feat(ci): add npm OIDC trusted publishing with provenance
- Add id-token: write permission for OIDC token generation - Switch from yarn publish to npm publish --provenance (Yarn 1.x does not support provenance attestations) - NPM_TOKEN kept as fallback until trusted publishing is configured on npmjs.com - Fix pr-quality.yml: secrets can't be referenced in if conditions; use fallback expression and || true for graceful failure
1 parent ece71c6 commit cb67c1f

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.github/workflows/pr-quality.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ jobs:
5252
run: gh pr review --approve "$PR_URL"
5353

5454
- name: Auto-approve (bot via APPROVE_TOKEN)
55-
if: steps.check-permission.outputs.permission == 'bot' && secrets.APPROVE_TOKEN != ''
55+
if: steps.check-permission.outputs.permission == 'bot'
5656
env:
5757
PR_URL: ${{ github.event.pull_request.html_url }}
58-
GH_TOKEN: ${{ secrets.APPROVE_TOKEN }}
59-
run: gh pr review --approve "$PR_URL"
58+
GH_TOKEN: ${{ secrets.APPROVE_TOKEN || secrets.GITHUB_TOKEN }}
59+
run: gh pr review --approve "$PR_URL" || true

.github/workflows/release.when-tagged.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Publish and create GitHub Release when a signed tag is pushed.
22
# Triggered by: git tag -s vX.Y.Z -m "vX.Y.Z" && git push origin vX.Y.Z
33
# Also available via workflow_dispatch for manual reruns.
4+
#
5+
# npm authentication uses OIDC trusted publishing (no NPM_TOKEN needed).
6+
# Setup: https://www.npmjs.com/package/@netresearch/node-magento-eqp/access
7+
# → Trusted Publisher → GitHub Actions → workflow: release.when-tagged.yml
48

59
name: 📦☁️ Release
610

@@ -13,6 +17,7 @@ on:
1317
permissions:
1418
contents: write
1519
packages: write
20+
id-token: write # OIDC trusted publishing to npm
1621

1722
env:
1823
HUSKY: '0'
@@ -37,8 +42,8 @@ jobs:
3742
- name: 🔨 Build
3843
run: yarn build:lib
3944

40-
- name: ☁️ Publish to NPM
41-
run: yarn publish --access=public
45+
- name: ☁️ Publish to NPM (OIDC + provenance)
46+
run: npm publish --access=public --provenance
4247
env:
4348
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4449

@@ -49,7 +54,7 @@ jobs:
4954
scope: '@netresearch'
5055

5156
- name: ☁️ Publish to GitHub Package Registry
52-
run: yarn publish --access=public
57+
run: npm publish --access=public
5358
env:
5459
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5560

0 commit comments

Comments
 (0)