Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add npm provenance to npm package #2205

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
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
20 changes: 11 additions & 9 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:

# Use specific Node.js version
- uses: actions/checkout@v3
- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
cache: 'npm'

# Install packages
Expand Down Expand Up @@ -85,10 +85,10 @@ jobs:

# Use specific Node.js version
- uses: actions/checkout@v3
- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
cache: 'npm'

# Install packages
Expand All @@ -115,10 +115,10 @@ jobs:

# Use specific Node.js version
- uses: actions/checkout@v3
- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
cache: 'npm'

# Install packages
Expand All @@ -141,6 +141,8 @@ jobs:
if: ${{ github.ref == 'refs/heads/master' }}
needs: [unit-and-coverage-tests, functional-tests, check-commit-message]
runs-on: ubuntu-latest
permissions:
id-token: write
Comment on lines +144 to +145
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason we need to elevate permission on id-token? According to npm provenance documentation, this seems mandatory to authenticate the action with its GITHUB_TOKEN. But can't find a documentation of the behavior of id_token.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't get into the details of the id-token permission, I followed the npm provenance doc that said to add it. You can find the documentation about id-token here

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! I understand the rationale now!

Ready To Merge then!

steps:

- uses: actions/checkout@v3
Expand All @@ -153,7 +155,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
registry-url: https://registry.npmjs.org/

- run: npm ci
Expand Down Expand Up @@ -257,10 +259,10 @@ jobs:

- uses: actions/checkout@v3

- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x

- name: Message commit
run: echo "is RELEASE => ${{ github.event.head_commit.message }} !!"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"watch": "cross-env BABEL_DISABLE_CACHE=1 babel --watch src --out-dir lib",
"changelog": "conventional-changelog -n ./config/conventionalChangelog/config.js -i changelog.md -s",
"bump": "if [ -z $npm_config_level ]; then grunt bump:minor; else grunt bump:$npm_config_level; fi && npm run changelog && git add -A && git commit --amend --no-edit",
"publish-next": "npm version prerelease --preid next && npm publish --access public --tag=next",
"publish-latest": "npm publish --access public --tag=latest"
"publish-next": "npm version prerelease --preid next && npm publish --access public --tag=next --provenance",
"publish-latest": "npm publish --access public --tag=latest --provenance"
},
"nyc": {
"exclude": [
Expand Down