ci: use OIDC trusted publishing instead of NPM_TOKEN
- Added environment: npm + id-token: write permission - Added --provenance flag for supply chain security - Removed NPM_TOKEN secret dependency - Added setup-node with registry-url for OIDC auth
This commit is contained in:
@@ -28,8 +28,10 @@ on:
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
environment: npm
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -37,12 +39,14 @@ jobs:
|
||||
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Configure npm auth
|
||||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
@@ -51,6 +55,8 @@ jobs:
|
||||
- name: Bump & publish core
|
||||
if: inputs.package == 'core' || inputs.package == 'both'
|
||||
working-directory: packages/core
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ""
|
||||
run: |
|
||||
npm version ${{ inputs.bump }} --no-git-tag-version
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
@@ -60,15 +66,17 @@ jobs:
|
||||
|
||||
if [ "${{ inputs.dry-run }}" = "true" ]; then
|
||||
echo "🏜️ Dry run — would publish @pascal-app/core@$VERSION"
|
||||
npm publish --dry-run
|
||||
npm publish --dry-run --access public
|
||||
else
|
||||
npm publish --access public
|
||||
npm publish --access public --provenance
|
||||
echo "📦 Published @pascal-app/core@$VERSION"
|
||||
fi
|
||||
|
||||
- name: Bump & publish viewer
|
||||
if: inputs.package == 'viewer' || inputs.package == 'both'
|
||||
working-directory: packages/viewer
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ""
|
||||
run: |
|
||||
npm version ${{ inputs.bump }} --no-git-tag-version
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
@@ -78,9 +86,9 @@ jobs:
|
||||
|
||||
if [ "${{ inputs.dry-run }}" = "true" ]; then
|
||||
echo "🏜️ Dry run — would publish @pascal-app/viewer@$VERSION"
|
||||
npm publish --dry-run
|
||||
npm publish --dry-run --access public
|
||||
else
|
||||
npm publish --access public
|
||||
npm publish --access public --provenance
|
||||
echo "📦 Published @pascal-app/viewer@$VERSION"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user