Skip to content

Commit

Permalink
chore: add npm provenance (#1258)
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Apr 30, 2023
1 parent 08fedc2 commit a88b58f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/npm_publish.yml
@@ -1,4 +1,5 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package

Expand All @@ -7,30 +8,32 @@ on:
types: [created]

permissions:
contents: read # to fetch code (actions/checkout)
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci --ignore-scripts
node-version: 18
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci --ignore-scripts
node-version: 18
- run: npm ci
- run: npm run build
- run: npm publish
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit a88b58f

Please sign in to comment.