generated from mmisty/cypress-template
-
Notifications
You must be signed in to change notification settings - Fork 7
121 lines (97 loc) · 2.94 KB
/
build.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
name: NodeJS with Webpack
permissions: write-all
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.12.0'
registry-url: 'https://registry.npmjs.org'
- uses: volta-cli/action@v4
- name: Install
uses: nick-fields/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: npm ci
- name: Versions
run: |
node --version
npm --version
- name: Lint
run: npm run lint
- name: Build
run: npm run build:all
- name: Test Jest
run: npm run test:jest
- name: Archive jest code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: ./reports/coverage-jest/lcov-report/
- name: Test Cy
run: npm run test:jest:cy
- name: Merge Cov
run: npm run cov:merge
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: ./reports/coverage-full-total/lcov-report/
- name: Monitor coverage
continue-on-error: true
uses: danhunsaker/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
clover-file: ./reports/coverage-full-total/clover.xml
- name: Publish Jest Test Report
uses: mikepenz/action-junit-report@v3
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/reports/jest/*.xml'
check_name: 'Jest Test Report'
detailed_summary: true
- name: Publish
if: success()
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
branch=${{ github.ref }}
echo "Branch: $branch"
gitmsg="${{ github.event.commits[0].message }}"
echo "Commit: $gitmsg"
if [[ "$gitmsg" =~ "[patch]" ]]; then
echo "publish patch"
npm run publish:patch
git push --tags
exit 0
fi
if [[ "$gitmsg" =~ "[fix]" ]]; then
echo "publish patch"
npm run publish:patch
git push --tags
exit 0
fi
if [[ "$gitmsg" =~ "[minor]" ]]; then
echo "publish minor"
npm run publish:minor
git push --tags
exit 0
fi
if [[ "$gitmsg" =~ "[major]" ]]; then
echo "publish major"
npm run publish:major
git push --tags
exit 0
fi
echo "publishing beta, for other commit message should contain [minor], [major] or [patch]/[fix]"
npm run publish:beta || true
# git push --tags || true