Skip to content

Commit b406cb7

Browse files
authored
Automate publishing (#8)
1 parent 6dad2a7 commit b406cb7

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/npm-publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Collaborators can publish a new version **of what's on master** by leaving a review on any PR, generally the PR that just closed.
2+
# To trigger this, the comment must match the format `🚀 version`, where "version" is anything accepted by `npm version XXX`
3+
4+
name: Publish
5+
6+
on:
7+
pull_request_review:
8+
types:
9+
- submitted
10+
11+
jobs:
12+
13+
npm:
14+
runs-on: ubuntu-latest
15+
if: contains('OWNER,COLLABORATOR', github.event.review.author_association) && startsWith(github.event.review.body, '🚀')
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
ref: master
20+
- run: npm install
21+
- uses: fregante/setup-git-token@v1
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
- name: npm version
25+
run: |
26+
WORDS=($COMMENT)
27+
npm version ${WORDS[1]}
28+
env:
29+
COMMENT: ${{ github.event.review.body }}
30+
- run: npm publish
31+
env:
32+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
33+
- run: git push --follow-tags

0 commit comments

Comments
 (0)