-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (39 loc) · 1.35 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
# https://httptoolkit.com/blog/automatic-npm-publish-gha/
name: Publish to NPM
on:
push:
branches:
- master
paths-ignore:
- 'docs/**'
jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- name: 'Checkout source code'
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: NPM RC
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_PUBLISH_TOKEN}" >> .npmrc
env:
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Install
run: yarn
- name: Build
run: yarn build
- name: Test
run: yarn test
- name: Bump version & push
run: |
git config --global user.name ${{ secrets.GIT_USER_NAME }}
git config --global user.email ${{ secrets.GIT_USER_EMAIL }}
# Update the version in package.json, and commit & tag the change:
npm version patch # YMMV - you might want the semver level as a workflow input
git push && git push --tags
- run: npm publish --access public