-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (36 loc) · 1.26 KB
/
npm-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
name: npm-publish
on:
push:
branches:
- chore/auto_publish # Change this to your default branch
jobs:
npm-publish:
name: npm-publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Check version changes
uses: EndBug/version-check@v2
id: check
- name: Version update detected
if: steps.check.outputs.changed == 'true'
run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'
- name: Draft release
if: steps.check.outputs.changed == 'true'
run: 'gh release create v${{ steps.check.outputs.version }} -d --notes ""'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Node.js for NPM
if: steps.check.outputs.changed == 'true'
uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
- name: Build lib
if: steps.check.outputs.changed == 'true'
run: "npm i && npm run buildLib"
- name: Publish package to NPM
if: steps.check.outputs.changed == 'true'
run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}