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
22
33on :
4- release :
5- types : [released]
64 pull_request :
7- types : [closed]
8- branches : [ master ]
95 workflow_dispatch :
10-
11- env :
12- CI : false
13-
6+
147jobs :
158 build :
169 runs-on : ubuntu-22.04
1912 uses : actions/checkout@v3
2013
2114 - name : Setup Node
22- uses : actions/setup-node@v3
15+ uses : actions/setup-node@v4
2316 with :
2417 node-version : 18.x
2518
5952
6053 - name : Run build backend server
6154 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 1111 - uses : actions/checkout@v3
1212
1313 - name : Use Node.js
14- uses : actions/setup-node@v3
14+ uses : actions/setup-node@v4
1515 with :
1616 node-version : 18.x
1717
Original file line number Diff line number Diff line change 1- name : Build and publish Github image
1+ name : Build artifact and package
22
33on :
44 release :
55 types : [released]
6- pull_request :
7- types : [closed]
8- branches : [ master ]
96 workflow_dispatch :
107
118jobs :
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+
1237 build :
1338 name : Build image
1439 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