-
Notifications
You must be signed in to change notification settings - Fork 1
142 lines (123 loc) · 3.96 KB
/
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
on:
push:
branches:
- master
name: pipeline
jobs:
Release:
name: Test & Build & Punlish
runs-on: ubuntu-latest
outputs:
releaseType: ${{ steps.publish.outputs.type }}
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.17
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v1
with:
path: node_modules
key: 18.17.x-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: NPM Install
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm install
- name: Lint
run: npm run-script lint
- name: Pretty
run: npm run-script prettier-check
- name: Test
run: npm test
- name: Build
run: npm run build
- name: Send Slack notification
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,action,took
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always() # Pick up events even if the job fails or is canceled.
- name: Publish
id: publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.JS_CLIENT_SDK_NPM_AUTH_TOKEN }}
- name: Send Slack notification
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo
text: Published to NPM ${{ steps.publish.outputs.old-version }} -> ${{ steps.publish.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: steps.publish.outputs.type != 'none' && always()
DeployExamplesLive:
name: DeployExamplesLive
needs: Release
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
fail-fast: true
matrix:
example:
[
reactjs-live,
reactts-live,
vanillajs-live,
vitereactts-live,
nextts-live,
nuxt3-live
]
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.17
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v1
with:
path: node_modules
key: 18.17.x-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: NPM Install
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm install
- name: Build
run: npm run build
- name: Install example dependencies
if: ${{matrix.example != 'vanillajs-live'}}
working-directory: examples/${{matrix.example}}
run: npm install
- name: Deploy example
working-directory: examples/${{matrix.example}}
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npm run deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Cypress:
name: Cypress
needs: DeployExamplesLive
runs-on: ubuntu-latest
container: cypress/browsers:node12.18.3-chrome87-ff82
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cypress run
uses: cypress-io/github-action@v4
with:
browser: chrome
record: true
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
CYPRESS_TESTING_MODE: 'LIVE'