Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,26 @@ permissions:
contents: write

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [20.x, 22.x]
cds-version: [latest]
steps:
- uses: actions/checkout@v5
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm i -g @sap/cds-dk@${{ matrix.cds-version }}
- run: npm i
- run: npm run build
- run: cd tests/bookshop && npm run build
- run: npm run test
publish-npm:
needs: test
runs-on: ubuntu-latest
environment: npm
steps:
Expand All @@ -16,15 +35,8 @@ jobs:
with:
node-version: 20
registry-url: https://registry.npmjs.org/

- name: Run Tests
run: |
npm install
npm run lint
cd tests/incidents-app && npm install
cd ../..
npm run test

- run: npm i
- run: npm run build
- name: get-version
id: package-version
uses: martinbeentjes/npm-get-version-action@v1.2.3
Expand All @@ -38,6 +50,4 @@ jobs:
with:
tag: 'v${{ steps.package-version.outputs.current-version }}'
body: '${{ steps.parse-changelog.outputs.body }}'
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
- run: npm publish --access public --provenance
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: npm publish --provenance requires id-token: write permission, which is missing

The --provenance flag generates a signed attestation for the published package. This requires the workflow to have permissions.id-token: write, otherwise the publish step will fail at runtime with a permissions error.

Should add id-token: write to the top-level permissions block (or scoped to the publish-npm job).

Suggested change
- run: npm publish --access public --provenance
- run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: NODE_AUTH_TOKEN environment variable was removed, breaking npm publish authentication

The original workflow passed NODE_AUTH_TOKEN: ${{secrets.npm_token}} as an env var to the publish step. Without it, npm publish will fail with an authentication error since the token is required to write to the registry.

Should restore the env block for the publish step.

Suggested change
- run: npm publish --access public --provenance
- run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

Loading