Skip to content

Commit f7d8bc4

Browse files
committed
workflow to publish package
1 parent 4a05eae commit f7d8bc4

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Node.js Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: 16
15+
- run: npm ci
16+
- run: npm test
17+
18+
publish-gpr:
19+
needs: build
20+
runs-on: ubuntu-latest
21+
permissions:
22+
packages: write
23+
contents: read
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 16
29+
registry-url: https://npm.pkg.github.com/
30+
- run: npm ci
31+
- run: npm publish
32+
env:
33+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@microsoft:registry=https://npm.pkg.github.com

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,8 @@
2323
"bugs": {
2424
"url": "https://github.com/microsoft/Windows-Containers-Tutorials/issues"
2525
},
26-
"homepage": "https://github.com/microsoft/Windows-Containers-Tutorials#readme"
27-
}
26+
"homepage": "https://github.com/microsoft/Windows-Containers-Tutorials#readme",
27+
"publishConfig": {
28+
"@microsoft:registry": "https://npm.pkg.github.com"
29+
}
30+
}

0 commit comments

Comments
 (0)