-
Notifications
You must be signed in to change notification settings - Fork 4
44 lines (38 loc) · 1.22 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
name: Publish to NPM
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
- "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
- run: if [ ! -x "$(command -v yarn)" ]; then npm install -g yarn; fi
- name: Install dependencies
run: |
yarn cache clean --all
yarn install
- name: Build
run: yarn run build
- name: Check if tag and version match
run: |
if [ "$(git tag --points-at ${{ github.sha }})" == "v$(jq -r .version packages/finschia/package.json)" ]; then
echo "Tag and version match. Proceeding with publish."
else
echo "Tag and version do not match. Skipping publish."
exit 1
fi
- name: Publish to NPM
run: |
cd packages/finschia
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}