-
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (64 loc) · 2.18 KB
/
nodejs.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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache Node Modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Lint code
run: npm run lint
- name: Build swagger-adjust
run: npm run build
- name: Cache demo Node Modules
id: cache-node-modules-demo
uses: actions/cache@v4
with:
path: demo/node_modules
key: node-modules-demo${{ hashFiles('demo/package-lock.json') }}
- name: Install demo dependencies
if: steps.cache-node-modules-demo.outputs.cache-hit != 'true'
run: npm ci
working-directory: ./demo
- name: Build demo
run: npm run build
working-directory: ./demo
- name: Upload build artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: build
path: ./demo/build
deploy:
name: Deploy demo
if: github.ref == 'refs/heads/main'
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download math result for job 1
uses: actions/download-artifact@v4
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages # The branch the action should deploy to.
folder: build # The folder the action should deploy.
clean: true # Automatically remove deleted files from the deploy branch