55 lines
1.3 KiB
YAML
55 lines
1.3 KiB
YAML
name: main
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
|
|
env:
|
|
REGISTRY: docker.io
|
|
IMAGE: ${{ github.repository }}
|
|
SERVICE: api # Restart the API service TODO and relays
|
|
|
|
jobs:
|
|
deploy:
|
|
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
|
|
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
# 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
|
|
|
|
# Log in to GCP
|
|
- uses: google-github-actions/auth@v1
|
|
with:
|
|
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
|
|
|
|
# Deploy to cloud run
|
|
- uses: google-github-actions/deploy-cloudrun@v1
|
|
with:
|
|
service: ${{env.SERVICE}}
|
|
image: ${{env.REGISTRY}}/${{env.IMAGE}}
|