-
Notifications
You must be signed in to change notification settings - Fork 114
40 lines (34 loc) · 1.05 KB
/
publish-npm.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
name: NPM package publishing
on:
push:
branches:
- main
jobs:
publish_npm:
name: Publish ${{ matrix.package }} NPM package
runs-on: ubuntu-latest
strategy:
matrix:
package: [javy, javy-cli]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
- name: Install package dependencies
run: npm install
working-directory: npm/${{ matrix.package }}
- name: Build NPM package
if: matrix.package == 'javy'
run: npm run build
working-directory: npm/${{ matrix.package }}
- name: Publish NPM package if new version
run: |
if [[ $(cat package.json | jq -r .version) == $(npm view ${{ matrix.package }} version) ]]; then
echo "Skipping publish because the version is already published"
else
npm publish
fi
working-directory: npm/${{ matrix.package }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}