Skip to content

Commit 67a0fb3

Browse files
Create npm-publish.yml
1 parent e0d99fc commit 67a0fb3

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/npm-publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: Publish Package to npmjs
5+
6+
on:
7+
release:
8+
types: [published]
9+
10+
jobs:
11+
build:
12+
permissions:
13+
contents: read
14+
# id-token: write is required for the automatic generation of provenance statements
15+
id-token: write
16+
runs-on: ubuntu-latest
17+
# The GitHub Actions Environment containing the `NPM_TOKEN`secret
18+
environment: npmjs:@sap_oss/automated-usage-tracking-tool
19+
steps:
20+
- uses: actions/checkout@v4
21+
# Setup .npmrc file to publish to npm
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: "20.x"
25+
# registry-url is required for releasing packages
26+
registry-url: "https://registry.npmjs.org"
27+
- run: npm ci
28+
29+
- name: Publish package
30+
# --provenance enables the automatic generation of provenance statements
31+
# --access public is only hard required for the initial release, but it doesn't hurt having it setup
32+
run: npm publish --provenance --access public
33+
env:
34+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)