Skip to content

Commit 7671806

Browse files
authored
[func] add action to publish to npm
1 parent 3875769 commit 7671806

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/npmpublish.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish package
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
publish-npm:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
ref: master
17+
18+
- name: Npm install
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: 12
22+
- run: npm install
23+
24+
- name: Check if version has been updated
25+
uses: EndBug/version-check@v1
26+
id: check
27+
28+
- name: Log when changed
29+
if: steps.check.outputs.changed == 'true'
30+
run: 'echo "Version change found in commit ${{ steps.check.outputs.commit }}! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'
31+
32+
- name: Log when unchanged
33+
if: steps.check.outputs.changed != 'true'
34+
run: 'echo "Version unchanged"'
35+
36+
- name: Set up Node.js for NPM
37+
uses: actions/setup-node@v1
38+
with:
39+
registry-url: "https://registry.npmjs.org"
40+
41+
- name: Publish package to NPM
42+
if: steps.check.outputs.changed == 'true'
43+
run: npm publish
44+
env:
45+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}

0 commit comments

Comments
 (0)