Update build.yml #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: pnpm run 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 | |
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 | |
uses: google-github-actions/auth@v1 | |
with: | |
workload_identity_provider: 'projects/799723412304/locations/global/workloadIdentityPools/github-gcr' | |
service_account: 'github-gcr-service-account@magnetic-lore-402317.iam.gserviceaccount.com' | |
- name: Build the Docker image | |
working-directory: backend/ | |
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) |