Skip to content

Commit

Permalink
A sketch for deploying the frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Liam Considine committed Aug 12, 2024
1 parent fbf0e69 commit 8eff04e
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/gcp-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy to Google Cloud Run

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '22.5'

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Setup Google Cloud SDK
uses: google-github-actions/[email protected]
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}

- name: Configure Docker
run: gcloud auth configure-docker

- name: Build and Deploy
run: |
gcloud builds submit --config cloudbuild.yaml
23 changes: 23 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA', '.']
# Push the container image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA']
# Deploy container image to Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
- 'run'
- 'deploy'
- '$REPO_NAME'
- '--image'
- 'gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA'
- '--region'
- 'us-central1'
- '--platform'
- 'managed'
- '--allow-unauthenticated'
images:
- 'gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA'

0 comments on commit 8eff04e

Please sign in to comment.