-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (40 loc) · 1.38 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
name: Code Build and Deployment
on:
push:
branches: [main]
workflow_dispatch:
# Allow one concurrent deployment
concurrency:
group: "build"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
name: Build and Deploy Code
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
- name: Install Dependencies
run: npm ci
- name: Build Code
run: npm run build --if-present
- name: Test Code
run: npm test
- name: Deploy Code to records Branch
run: |
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
cp -R dist/* .
git add -A
git diff-index --quiet HEAD || git commit -am "temp commit dist"
git fetch
git checkout records
git restore --source main *.js *.js.map *.svg package.json package-lock.json docs/*.html docs/*.js
git add -A
git diff-index --quiet HEAD || git commit -am "Deploy new build"
git push origin records