-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (79 loc) · 2.28 KB
/
build-master.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
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
80
81
82
83
84
85
86
87
88
name: Build and release master
on:
push:
branches: [ master ]
paths-ignore:
- 'CHANGELOG.md'
workflow_dispatch:
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12, 13, 14, 15, 16]
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install packages
run: npm ci && npm run postinstall --if-present
- name: Transpile with Typescript
run: npm run dist --if-present
- name: Run tests
run: npm run test --if-present
echoPendingChangelog:
name: Render pending changelog
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
- name: Generate standard version changelog
run: |
npm ci
npx standard-version --skip.commit --skip.tag
UPDATED_VERSION=$(jq '.version' --raw-output package.json)
npx changelog-parser | jq --raw-output --arg UPDATED_VERSION "$UPDATED_VERSION" '.versions[] | select(.version==$UPDATED_VERSION).body | if . != "" then . else "[[empty]]" end'
release:
needs: build
name: Create release
runs-on: ubuntu-latest
environment:
name: publishing
defaults:
run:
shell: bash
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
- name: Install packages
run: npm ci && npm run postinstall --if-present
- name: Tag release and push to Github
run: |
set -e
git config --local user.name "Github Actions"
git config --local user.email "[email protected]"
git pull origin master
npm run release
npm run generate-docs
git add -A
git commit -q -m "chore: updated typedocs"
git push --tags origin master
- name: Publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}