2023-09-17 06:38:04 +00:00
|
|
|
on:
|
2023-10-13 01:47:10 +00:00
|
|
|
push:
|
|
|
|
branches: ["main"]
|
2023-09-17 06:38:04 +00:00
|
|
|
|
|
|
|
env:
|
2023-10-13 01:47:10 +00:00
|
|
|
REGISTRY: us-central1-docker.pkg.dev
|
|
|
|
IMAGE: quic-video/deploy/moq-rs:latest
|
|
|
|
SERVICE: api # Restart the API service TODO and relays
|
2023-09-17 06:38:04 +00:00
|
|
|
|
|
|
|
jobs:
|
2023-10-13 01:47:10 +00:00
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
# Only one release at a time and cancel prior releases
|
|
|
|
concurrency:
|
|
|
|
group: release
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
# I'm paying for Depot for faster ARM builds.
|
|
|
|
- uses: depot/setup-action@v1
|
|
|
|
|
|
|
|
# Log in to GCP
|
|
|
|
- uses: google-github-actions/auth@v1
|
|
|
|
id: auth
|
|
|
|
with:
|
|
|
|
token_format: access_token
|
|
|
|
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
|
|
|
|
|
|
|
|
# Log into the docker registry via the GCP token
|
|
|
|
- uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: oauth2accesstoken
|
|
|
|
password: ${{ steps.auth.outputs.access_token }}
|
|
|
|
|
|
|
|
# Build and push Docker image with Depot
|
|
|
|
- uses: depot/build-push-action@v1
|
|
|
|
with:
|
|
|
|
project: r257ctfqm6
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
tags: ${{env.REGISTRY}}/${{env.IMAGE}}
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
|
|
|
|
# Deploy to cloud run
|
|
|
|
- uses: google-github-actions/deploy-cloudrun@v1
|
|
|
|
with:
|
|
|
|
service: ${{env.SERVICE}}
|
|
|
|
image: ${{env.REGISTRY}}/${{env.IMAGE}}
|