forked from 42Flowers/transcendence
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (78 loc) · 2.33 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
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
name: Build frontend
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build_frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
cache: 'pnpm'
cache-dependency-path: frontend/pnpm-lock.yaml
node-version: 18.x
- name: Install dependencies
working-directory: frontend/
run: pnpm i --frozen-lockfile
- name: Build
working-directory: frontend/
run: pnpx vite build
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: frontend-data
path: frontend/dist
build_backend:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
cache: 'pnpm'
cache-dependency-path: backend/pnpm-lock.yaml
node-version: 18.x
- name: Install dependencies
working-directory: backend/
run: pnpm i --frozen-lockfile
- name: Generate Prisma client schema
working-directory: backend
run: npx prisma generate
- name: Build
working-directory: backend/
run: pnpm run build
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: backend-data
path: backend/dist
- name: Authenticate To Google Cloud
id: auth
uses: google-github-actions/auth@v1
with:
token_type: access_token
workload_identity_provider: 'projects/799723412304/locations/global/workloadIdentityPools/github-gcr'
service_account: 'github-gcr-service-account@magnetic-lore-402317.iam.gserviceaccount.com'
access_token_lifetime: 300s
- name: Login to Artifact Registry
uses: docker/login-action@v1
with:
registry: europe-west9-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Build the Docker image
working-directory: backend/
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)