-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (37 loc) · 1.13 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
41
42
43
44
45
46
name: Publish to npm
on:
push:
branches:
- main
jobs:
verify:
name: Publish if pkg version changed
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
submodules: recursive
- name: Get package version
id: get_pkg_version
run: echo "pkg_version=$(cat package.json | jq -r .version)" >> "$GITHUB_OUTPUT"
- name: Get npm version
id: get_npm_version
run: echo "npm_version=$(npm view java-slang version)" >> "$GITHUB_OUTPUT"
- name: Stop if version has not changed
if: steps.get_pkg_version.outputs.pkg_version == steps.get_npm_version.outputs.npm_version
run: exit 1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}