Skip to content

Commit 3cd2a99

Browse files
authored
Merge pull request #36 from veghdev/rel
workflows: set up release
2 parents c80c1cf + 49da0ec commit 3cd2a99

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
jobs:
13+
deploy:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Initialize development environment
21+
run: npm install
22+
23+
- name: Release package
24+
run: npm run release
25+
env:
26+
NPM_TOKEN: ${{ secrets.NPM_API_TOKEN }}
27+
if: ( github.event_name == 'release' && github.event.action == 'published' ) || github.event_name == 'workflow_dispatch'
28+
29+
- name: Upload package
30+
run: |
31+
gh auth login --with-token ${{ secrets.GITHUB_TOKEN }}
32+
gh release upload ${{ github.event.release.tag_name }} build/*tgz --clobber
33+
if: ( github.event_name == 'release' && github.event.action == 'published' ) || github.event_name == 'workflow_dispatch'

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"check": "npm-run-all check-prettier check-eslint",
1414
"docs": "npx jsdoc -d docs -r README.md ./src/*js",
1515
"rollup": "rollup -c",
16-
"pack": "mkdir -p build && npm pack --pack-destination build && tar -ztvf build/*.tgz"
16+
"pack": "mkdir -p build && npm pack --pack-destination build && tar -ztvf build/*.tgz",
17+
"release": "npm-run-all rollup pack && npm publish"
1718
},
1819
"repository": {
1920
"type": "git",

0 commit comments

Comments
 (0)