-
Notifications
You must be signed in to change notification settings - Fork 320
95 lines (71 loc) · 1.85 KB
/
cd.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Test & Deploy
on:
workflow_dispatch:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: current
- uses: actions/checkout@v3
- run: npm audit --omit=dev
test:
needs: [ audit ]
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ '14', '16', '18' ]
steps:
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/checkout@v3
- run: npm ci
- name: Test
run: npm test
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
retention-days: 7
- uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos
path: cypress/videos
retention-days: 7
deploy:
needs: [ test ]
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/setup-node@v3
with:
node-version: current
- uses: actions/checkout@v3
- run: npm ci
- name: Deploy @latest version to npm
if: startsWith(github.ref, 'refs/tags/')
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
- name: Update @next version
if: startsWith(github.ref, 'refs/heads/')
run: npm version prerelease --no-git-tag-version --preid "$GITHUB_RUN_NUMBER"
- name: Deploy @next version to npm
if: startsWith(github.ref, 'refs/heads/')
uses: JS-DevTools/npm-publish@v1
with:
tag: next
token: ${{ secrets.NPM_TOKEN }}
check-version: false