Skip to content

Commit 2de8db7

Browse files
committed
Publish to Github Packages
1 parent be4f5f7 commit 2de8db7

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

.github/workflows/publish.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow will run tests using node and then publish a package to npm when a release is created
1+
# This workflow will run tests using node and then publish a package when a release is created
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
33

44
name: Publish Package
@@ -8,7 +8,23 @@ on:
88
types: [created]
99

1010
jobs:
11+
build-and-test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: 14
18+
- run: npm ci
19+
- run: npm run build
20+
- run: npm test
21+
- uses: actions/upload-artifact@v2
22+
with:
23+
name: dist
24+
path: dist
25+
1126
publish-npm:
27+
needs: build-and-test
1228
runs-on: ubuntu-latest
1329
steps:
1430
- uses: actions/checkout@v2
@@ -17,8 +33,26 @@ jobs:
1733
node-version: 14
1834
registry-url: https://registry.npmjs.org/
1935
- run: npm ci
20-
- run: npm test
21-
- run: npm run build
36+
- uses: actions/download-artifact@v2
37+
with:
38+
name: dist
39+
- run: npm publish
40+
env:
41+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
42+
43+
publish-gpr:
44+
needs: build-and-test
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v2
48+
- uses: actions/setup-node@v1
49+
with:
50+
node-version: 14
51+
registry-url: https://npm.pkg.github.com/
52+
- run: npm ci
53+
- uses: actions/download-artifact@v2
54+
with:
55+
name: dist
2256
- run: npm publish
2357
env:
24-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
58+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)