This repository has been archived by the owner on Jan 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (82 loc) · 2.28 KB
/
ci.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
89
90
91
92
93
94
95
96
97
name: main
on:
push:
branches:
- v*
paths-ignore:
- CHANGELOG.md
workflow_dispatch:
inputs:
deploy:
description: "Deploy? (y/sha/N)"
required: false
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bahmutov/npm-install@v1
- run: yarn install --frozen-lockfile
- run: |
yarn concurrently \
--names "lint,test,test:ts,build,docs" \
"yarn lint" \
"yarn test" \
"yarn test:ts" \
"yarn build" \
"yarn docs"
- run: |
yarn test:uat
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist
- uses: actions/upload-artifact@v2
with:
name: docs
path: docs
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
if: ${{ github.event.inputs.deploy == 'y' || github.event.inputs.deploy == 'sha' }}
concurrency:
group: deploy
cancel-in-progress: true
env:
# workaround https://github.com/JS-DevTools/npm-publish/issues/15
INPUT_TOKEN: ""
PUBLISH_CHANNEL: ${{ github.event.inputs.deploy == 'y' && 'latest' || 'sha' }}
steps:
- uses: actions/checkout@v2
with: { fetch-depth: 0 }
- uses: bahmutov/npm-install@v1
- run: yarn install --frozen-lockfile
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- if: ${{ env.PUBLISH_CHANNEL == 'latest' }}
run: oTAG= yarn build:version
- if: ${{ env.PUBLISH_CHANNEL == 'sha' }}
run: oTAG= oSHA= yarn build:version
- run: echo ${{ env.PUBLISH_CHANNEL }}
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./dist/package.json
access: public
tag: ${{ env.PUBLISH_CHANNEL }}
- uses: ad-m/github-push-action@master
with:
tags: true
- uses: actions/download-artifact@v2
with:
name: docs
path: docs
- if: ${{ env.PUBLISH_CHANNEL == 'latest' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs