-
Notifications
You must be signed in to change notification settings - Fork 668
167 lines (163 loc) · 4.57 KB
/
push.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: CI/CD
on: [push, pull_request]
jobs:
setup:
name: setup
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: Install
run: yarn install --frozen-lockfile
build:
name: build
runs-on: ubuntu-latest
needs: setup
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: Install
run: yarn install
- name: Assets cache
uses: actions/cache@v3
id: assets-cache
with:
path: src/frontend/assets/scripts
key: assets-${{ hashFiles('**/src/frontend/global-entry.js') }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/bin/bundle-globals.js') }}
restore-keys: |
assets-
- name: build
run: yarn build
- name: types
run: yarn types
- name: bundle globals production
if: steps.assets-cache.outputs.cache-hit != 'true'
run: NODE_ENV=production yarn bundle:globals
- name: bundle globals dev
if: steps.assets-cache.outputs.cache-hit != 'true'
run: NODE_ENV=dev yarn bundle:globals
- name: bundle production
run: NODE_ENV=production ONCE=true yarn bundle
- name: bundle dev
run: ONCE=true yarn bundle
- name: Upload Build
if: |
contains(github.ref, 'refs/heads/master')
|| contains(github.ref, 'refs/heads/beta-v7')
|| contains(github.ref, 'refs/heads/beta')
uses: actions/upload-artifact@v3
with:
name: lib
path: lib
- name: Upload Types
if: |
contains(github.ref, 'refs/heads/master')
|| contains(github.ref, 'refs/heads/beta-v7')
|| contains(github.ref, 'refs/heads/beta')
uses: actions/upload-artifact@v3
with:
name: types
path: types
- name: Upload Bundle
if: |
contains(github.ref, 'refs/heads/master')
|| contains(github.ref, 'refs/heads/beta-v7')
|| contains(github.ref, 'refs/heads/beta')
uses: actions/upload-artifact@v3
with:
name: bundle
path: lib/frontend/assets/scripts
test:
name: Test
runs-on: ubuntu-latest
needs: setup
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: Install
run: yarn install
- name: Lint
run: yarn lint
- name: spell
run: yarn cspell
- name: install codecov
run: yarn global add codecov
if: contains(github.ref, 'refs/heads/master')
- name: cover
if: contains(github.ref, 'refs/heads/master')
run: yarn codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: test
if: "!contains(github.ref, 'refs/heads/master')"
run: yarn test
publish:
name: Publish
if: |
github.event_name == 'push'
&& (
contains(github.ref, 'refs/heads/master')
|| contains(github.ref, 'refs/heads/beta-v7')
|| contains(github.ref, 'refs/heads/beta')
)
needs:
- test
- build
services:
mongo:
image: mongo:3.4.23
ports:
- 27017:27017
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: Install
run: yarn install
- name: Download Build
uses: actions/download-artifact@v3
with:
name: lib
path: lib
- name: Download Types
uses: actions/download-artifact@v3
with:
name: types
path: types
- name: Download Bundle
uses: actions/download-artifact@v3
with:
name: bundle
path: bundle
- name: Check directories exists
uses: andstor/file-existence-action@v2
with:
files: "bundle/, lib/, types/"
fail: true
- name: Release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }}
JIRA_EMAIL: ${{ secrets.JIRA_EMAIL }}
run: yarn release