-
Notifications
You must be signed in to change notification settings - Fork 42
53 lines (45 loc) · 1.44 KB
/
npm-publish.yaml
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
52
53
name: Publish NPM Package for Sysl
on:
push:
branches:
- master
paths:
- "ts/**"
- .github/workflows/npm-publish.yaml
jobs:
check-version:
runs-on: ${{ vars.RUNNER_UBUNTU && fromJSON(vars.RUNNER_UBUNTU) || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
# This one-liner will exit 1 if the current version in package.json exists in the registry.
- name: Ensure new version
run: |
! npm view @anz-bank/sysl versions --json | grep "$(node -e 'console.log(require("./package.json").version)')"
working-directory: ts
env:
NPM_CONFIG_REGISTRY: ${{ vars.NPM_CONFIG_REGISTRY }}
publish:
needs: check-version
runs-on: ${{ vars.RUNNER_UBUNTU && fromJSON(vars.RUNNER_UBUNTU) || 'ubuntu-latest' }}
if: ${{ github.repository_owner == 'anz-bank' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
always-auth: true
- name: Install Project
run: yarn install --frozen-lockfile
working-directory: ts
- name: Build
run: yarn build
working-directory: ts
- name: Publish Package
run: yarn publish
working-directory: ts/dist
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}