Skip to content

Commit a0d8682

Browse files
authored
chore: add the provenance flag when publishing to npm (#556)
* This also splits the GH release and npm publish workflows Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
1 parent 023171d commit a0d8682

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

.github/workflows/publish-to-npm.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish to npmjs
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
id-token: write
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: '18.x'
16+
registry-url: 'https://registry.npmjs.org'
17+
- run: npm install -g npm
18+
- run: npm ci
19+
- run: npm publish --provenance --access public
20+
env:
21+
NODE_AUTH_TOKEN: ${{ secrets.CLOUDEVENTS_PUBLISH }}

.github/workflows/release-please.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,7 @@ jobs:
1010
- uses: GoogleCloudPlatform/release-please-action@v3
1111
id: release
1212
with:
13-
token: ${{ secrets.GITHUB_TOKEN }}
13+
token: ${{ secrets.CLOUDEVENTS_RELEASES_TOKEN }}
1414
release-type: node
1515
package-name: cloudevents
1616
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"docs","section":"Documentation","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false},{"type":"src","section":"Miscellaneous","hidden":false},{"type":"style","section":"Miscellaneous","hidden":false},{"type":"refactor","section":"Miscellaneous","hidden":false},{"type":"perf","section":"Performance","hidden":false},{"type":"test","section":"Tests","hidden":false}]'
17-
18-
- uses: actions/checkout@v3
19-
if: ${{ steps.release.outputs.release_created }}
20-
- uses: actions/setup-node@v3
21-
with:
22-
node-version: 16
23-
registry-url: 'https://registry.npmjs.org'
24-
if: ${{ steps.release.outputs.release_created }}
25-
- run: npm ci
26-
if: ${{ steps.release.outputs.release_created }}
27-
- run: npm test
28-
if: ${{ steps.release.outputs.release_created }}
29-
- run: npm publish
30-
env:
31-
NODE_AUTH_TOKEN: ${{secrets.CLOUDEVENTS_PUBLISH}}
32-
if: ${{ steps.release.outputs.release_created }}

0 commit comments

Comments
 (0)