-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (96 loc) · 2.74 KB
/
frontend.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: frontend
on:
workflow_dispatch:
push:
paths:
- 'packages/frontend/**'
branches:
- main
tags:
- "v*.*.*"
pull_request:
paths:
- 'packages/frontend/**'
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
name: Check for Linting Errors
defaults:
run:
working-directory: packages/frontend
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 22
- name: NPM Install
run: npm install --only=dev
shell: bash
- name: Check for Formatting Issues
run: npm run format
- name: Check for Linting Issues
run: npm run lint
build:
runs-on: ubuntu-latest
name: Build Code
defaults:
run:
working-directory: packages/frontend
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 22
- name: NPM Install
run: npm install
shell: bash
- name: Build
run: npm run build
docker:
name: Docker Build and Push
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/frontend
steps:
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Checkout repository
uses: actions/checkout@v3
- name: Docker Tags
id: meta
uses: docker/metadata-action@v4
with:
images: |
hicsail/comets-frontend
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to Docker Hub
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & Push Docker Build
uses: docker/build-push-action@v4
with:
push: ${{ github.event_name != 'pull_request' }}
context: ./packages/frontend
file: ./packages/frontend/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=gateway
cache-to: type=gha,mode=max,scope=gateway
build-args: |
VITE_COMETS_BACKEND=${{ secrets.BACKEND_URL }}