Skip to content

Commit 0c370de

Browse files
authored
Merge pull request #14 from CoditEU/feature/ci-publish
👷‍♂️ added ci build
2 parents 94936dc + d21f481 commit 0c370de

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/npm-publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: NPM publish
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Package version'
10+
required: true
11+
default: v2.0.0
12+
13+
jobs:
14+
publish-npm:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Set version for release trigger
19+
uses: allenevans/[email protected]
20+
if: ${{ github.event_name == 'release' }}
21+
with:
22+
PACKAGE_VERSION: ${{github.event.release.tag_name}}
23+
- name: Set version for workflow dispatch
24+
uses: allenevans/[email protected]
25+
if: ${{ github.event_name == 'workflow_dispatch' }}
26+
with:
27+
PACKAGE_VERSION: ${{ github.event.inputs.version }}
28+
- uses: actions/setup-node@v2
29+
with:
30+
node-version: 12
31+
registry-url: https://registry.npmjs.org/
32+
- run: npm ci
33+
- run: npm version ${{env.PACKAGE_VERSION}}
34+
- run: npm publish --access public
35+
env:
36+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)