Skip to content

Deploy

Deploy #72

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
name: "Build"
runs-on: "ubuntu-latest"
environment: "cloud"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Authorise GCP
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.SERVICE_TOKEN }}
- name: Build docker image
run: docker build -t balance .
- name: Tag docker image
run: |
docker tag balance asia-southeast1-docker.pkg.dev/baileybutler-syd/balance/balance:${{ github.sha }}
docker tag balance asia-southeast1-docker.pkg.dev/baileybutler-syd/balance/balance:latest
- name: Authorise docker
run: |
gcloud auth configure-docker -q
gcloud auth configure-docker asia-southeast1-docker.pkg.dev
- name: Publish image
run: |
docker push asia-southeast1-docker.pkg.dev/baileybutler-syd/balance/balance:${{ github.sha }}
docker push asia-southeast1-docker.pkg.dev/baileybutler-syd/balance/balance:latest
deploy:
name: "Deploy"
runs-on: ubuntu-latest
environment: cloud
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Authenticate Google Cloud Platform
uses: google-github-actions/auth@v1
with:
credentials_json: "${{ secrets.SERVICE_TOKEN }}"
- name: Deploy Cloud Run
uses: google-github-actions/deploy-cloudrun@v2
with:
project_id: baileybutler-syd
service: balance
image: asia-southeast1-docker.pkg.dev/baileybutler-syd/balance/balance:${{ github.sha }}
region: asia-southeast1
env_vars: GCP_PROJECT=${{ secrets.GCP_PROJECT }}
secrets: |
UP_TOKEN=${{ secrets.GSM_UP_SECRET }}:latest
UP_WEBHOOK_SECRET=${{ secrets.GSM_UP_WEBHOOK_TOKEN }}:latest
flags: "--allow-unauthenticated"