-
Notifications
You must be signed in to change notification settings - Fork 2
37 lines (37 loc) · 1.14 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
name: Publish npm package
on:
push:
branches:
- master
jobs:
publish:
name: publish
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# only publish on non-chore commit messages
if: "contains(toJson(github.event.commits), 'chore(release):') == false"
steps:
- run: "echo 'messages: ${{ toJson(github.event.commits.*.message) }}'"
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: npm ci
- run: npx commitlint --from ${{ github.ref }}
- name: Generate changelog, tag, and commit
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
npx standard-version
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tags: true
# I can't put this in the actual .npmrc file because it stops normal npm install
- run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
npm publish
rm .npmrc