Skip to content
This repository was archived by the owner on Jan 2, 2023. It is now read-only.

Commit 8602712

Browse files
author
Bassem Dghaidi
committed
Rewrite publish workflow
1 parent 1436be6 commit 8602712

File tree

1 file changed

+37
-20
lines changed

1 file changed

+37
-20
lines changed

.github/workflows/publish.yml

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,44 @@
11
name: npm-publish
22

33
on:
4-
push:
5-
branches:
6-
- master
4+
release:
5+
types: [created]
76

87
jobs:
9-
npm-publish:
10-
name: npm-publish
8+
build:
119
runs-on: ubuntu-latest
1210
steps:
13-
- name: Checkout repository
14-
uses: actions/checkout@master
15-
- name: Set up Node.js
16-
uses: actions/setup-node@master
17-
with:
18-
node-version: 10.0.0
19-
- name: Publish if version has been updated
20-
uses: pascalgn/npm-publish-action@4f4bf159e299f65d21cd1cbd96fc5d53228036df
21-
with: # All of theses inputs are optional
22-
tag_name: "%s"
23-
tag_message: "%s"
24-
commit_pattern: "^Release (\\S+)"
25-
env:
26-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated
27-
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You need to set this in your repo settings
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v1
13+
with:
14+
node-version: 10.0.0
15+
- run: npm ci
16+
- run: npm test
17+
18+
publish-npm:
19+
needs: build
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v2
23+
- uses: actions/setup-node@v1
24+
with:
25+
node-version: 10
26+
registry-url: https://registry.npmjs.org/
27+
- run: npm ci
28+
- run: npm publish
29+
env:
30+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
31+
32+
publish-gpr:
33+
needs: build
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v2
37+
- uses: actions/setup-node@v1
38+
with:
39+
node-version: 10
40+
registry-url: https://npm.pkg.github.com/
41+
- run: npm ci
42+
- run: npm publish
43+
env:
44+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)