Skip to content

Oublie

Oublie #22

Workflow file for this run

name: Build and deploy
on:
push:
branches: [ "main" ]
jobs:
build_frontend:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- name: Authenticate To Google Cloud
id: auth
uses: google-github-actions/auth@v1
with:
token_format: access_token
workload_identity_provider: ${{ secrets.WIF_PROVIDER }}
service_account: ${{ secrets.WIF_SERVICE_ACCOUNT }}
access_token_lifetime: 300s
- 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: 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: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: frontend-data
path: frontend/dist
- name: Build, tag and push container
id: build-image
uses: docker/build-push-action@v3
with:
context: frontend/
push: true
tags: |
europe-west9-docker.pkg.dev/magnetic-lore-402317/transcendence/frontend:${{ github.sha }}
- name: 'Deploy to Cloud Run'
id: 'deploy'
uses: 'google-github-actions/deploy-cloudrun@v1'
with:
service: 'transcendence-frontend'
image: europe-west9-docker.pkg.dev/magnetic-lore-402317/transcendence/frontend:${{ github.sha }}
- name: 'Use output'
run: 'curl "${{ steps.deploy.outputs.url }}"'