File tree Expand file tree Collapse file tree 4 files changed +71
-44
lines changed Expand file tree Collapse file tree 4 files changed +71
-44
lines changed Original file line number Diff line number Diff line change 1
- name : Artifact
1
+ name : Build
2
2
3
3
on :
4
- release :
5
- types : [released]
6
4
pull_request :
7
- types : [closed]
8
- branches : [ master ]
9
5
workflow_dispatch :
10
-
11
- env :
12
- CI : false
13
-
6
+
14
7
jobs :
15
8
build :
16
9
runs-on : ubuntu-22.04
19
12
uses : actions/checkout@v3
20
13
21
14
- name : Setup Node
22
- uses : actions/setup-node@v3
15
+ uses : actions/setup-node@v4
23
16
with :
24
17
node-version : 18.x
25
18
59
52
60
53
- name : Run build backend server
61
54
run : npm run backend:build
62
-
63
- deploy :
64
- runs-on : ubuntu-22.04
65
- needs : build
66
- steps :
67
- - name : Checkout source code
68
- uses : actions/checkout@v3
69
-
70
- - name : Cache build frontend
71
- uses : actions/cache@v3
72
- id : cache-build-frontend
73
- with :
74
- path : apps/frontend
75
- key : ${{ runner.os }}-frontend-${{ github.sha }}
76
-
77
- - name : Cache build backend
78
- uses : actions/cache@v3
79
- id : cache-build-backend
80
- with :
81
- path : apps/backend
82
- key : ${{ runner.os }}-backend-${{ github.sha }}
83
-
84
- - name : Compress files
85
- run : tar -czf /tmp/clnapp.tar.gz apps/frontend/build apps/backend/dist package.json package-lock.json
86
-
87
- - uses : actions/upload-artifact@v3
88
- with :
89
- name : clnapp-build$VERSION
90
- path : /tmp/clnapp.tar.gz
Original file line number Diff line number Diff line change 11
11
- uses : actions/checkout@v3
12
12
13
13
- name : Use Node.js
14
- uses : actions/setup-node@v3
14
+ uses : actions/setup-node@v4
15
15
with :
16
16
node-version : 18.x
17
17
Original file line number Diff line number Diff line change 1
- name : Build and publish Github image
1
+ name : Build artifact and package
2
2
3
3
on :
4
4
release :
5
5
types : [released]
6
- pull_request :
7
- types : [closed]
8
- branches : [ master ]
9
6
workflow_dispatch :
10
7
11
8
jobs :
9
+ artifact :
10
+ runs-on : ubuntu-22.04
11
+ steps :
12
+ - name : Checkout source code
13
+ uses : actions/checkout@v3
14
+
15
+ - name : Cache build frontend
16
+ uses : actions/cache@v3
17
+ id : cache-build-frontend
18
+ with :
19
+ path : apps/frontend
20
+ key : ${{ runner.os }}-frontend-${{ github.sha }}
21
+
22
+ - name : Cache build backend
23
+ uses : actions/cache@v3
24
+ id : cache-build-backend
25
+ with :
26
+ path : apps/backend
27
+ key : ${{ runner.os }}-backend-${{ github.sha }}
28
+
29
+ - name : Compress files
30
+ run : tar -czf /tmp/clnapp.tar.gz apps/frontend/build apps/backend/dist package.json package-lock.json
31
+
32
+ - uses : actions/upload-artifact@v3
33
+ with :
34
+ name : clnapp-build$VERSION
35
+ path : /tmp/clnapp.tar.gz
36
+
12
37
build :
13
38
name : Build image
14
39
runs-on : ubuntu-22.04
Original file line number Diff line number Diff line change
1
+ name : Unit tests
2
+
3
+ on :
4
+ pull_request :
5
+ workflow_dispatch :
6
+
7
+ jobs :
8
+ test :
9
+ runs-on : ubuntu-22.04
10
+ steps :
11
+ - name : Checkout source code
12
+ uses : actions/checkout@v3
13
+
14
+ - name : Setup Node
15
+ uses : actions/setup-node@v4
16
+ with :
17
+ node-version : 18.x
18
+
19
+ - name : Get version from package.json
20
+ id : package-version
21
+ run : |
22
+ echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
23
+ echo "Project Version: $VERSION"
24
+
25
+ - name : Cache node_modules
26
+ uses : actions/cache@v3
27
+ id : cache-npm-packages
28
+ with :
29
+ path : node_modules
30
+ key : ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
31
+
32
+ - name : Install NPM dependencies
33
+ if : steps.cache-npm-packages.outputs.cache-hit != 'true'
34
+ run : npm clean-install
35
+
36
+ - name : Run frontend unit tests
37
+ run : npm run frontend:test
38
+
You can’t perform that action at this time.
0 commit comments