-
Notifications
You must be signed in to change notification settings - Fork 9
79 lines (69 loc) · 2.37 KB
/
build_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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Build and Release
on:
push:
branches:
- create-npm-package
workflow_dispatch:
jobs:
build-release:
name: Build the web app and make a zip release
runs-on: ubuntu-latest
steps:
- name: Checkout to repository
uses: actions/checkout@v3
- name: Setup Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Install dependencies
run: yarn install
- name: Run tests
run: yarn test
- name: Build the app
run: yarn build-prod
- id: versionCheck
uses: EndBug/version-check@v2
with:
file-url: https://unpkg.com/person-management-app@latest/package.json
static-checking: localIsNew
- name: Version guard
if: steps.versionCheck.outputs.changed == 'false'
uses: actions/github-script@v3
with:
script: |
core.setFailed('No version change detected. You should run `yarn bump:<patch|minor|major>` to bump the version')
- name: Publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
yarn publish --new-version ${{ steps.versionCheck.outputs.version }}
- id: versionCheck
uses: EndBug/version-check@v2
with:
file-url: https://unpkg.com/person-management-app@latest/package.json
static-checking: localIsNew
- name: Version guard
if: steps.versionCheck.outputs.changed == 'false'
uses: actions/github-script@v3
with:
script: |
core.setFailed('No version change detected. You should run `yarn bump:<patch|minor|major>` to bump the version')
- name: Publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
yarn publish --new-version ${{ steps.versionCheck.outputs.version }}
- name: Create Tag
uses: actions/github-script@v5
env:
VERSION: ${{ steps.versionCheck.outputs.version }}
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v' + process.env.VERSION,
sha: context.sha
})