-
Notifications
You must be signed in to change notification settings - Fork 16
47 lines (42 loc) · 1.17 KB
/
ci.yaml
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
# purpose: Continuous Integration (build, test, lint, scan)
name: CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch: {}
concurrency:
group: "ci"
cancel-in-progress: true
env:
app_image: hobbyfarm/admin-ui
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Node.js (LTS)
uses: actions/setup-node@v3
with:
node-version: 18
- name: Setup node_modules cache
id: cache-nodemodules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Build
run: npm run build:prod
env:
NODE_OPTIONS: '--openssl-legacy-provider'
# TODO: lint, sonar, tests
- name: Create container image
run: |
docker build -f .github/workflows/Dockerfile-ci -t hobbyfarm/admin-ui:${GIT_COMMIT_SHORT_HASH:-dev} .