Skip to content

New event types

New event types #67

Workflow file for this run

---
name: Build and deploy API Docker image
on:
push:
branches:
- main
paths:
- src/rust/api/**
- src/rust/db/**
- src/rust/types/**
- src/rust/Cargo.toml
- src/rust/Cargo.lock
- src/rust/.dockerignore
- .github/workflows/deploy-api.yml
pull_request:
branches:
- main
paths:
- src/rust/api/**
- src/rust/db/**
- src/rust/types/**
- src/rust/Cargo.toml
- src/rust/Cargo.lock
- src/rust/.dockerignore
- .github/workflows/deploy-api.yml
jobs:
build:
name: Build API Docker image
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Configure Docker driver
run: docker buildx create --use --driver=docker-container
- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: ./src/rust
tags: asia-northeast1-docker.pkg.dev/econia-0/econia-backend/api:latest
file: ./src/rust/api/Dockerfile
outputs: type=docker,dest=/tmp/image.tar
cache-from: type=gha
cache-to: type=gha,mode=max
push: false
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: image
path: /tmp/image.tar
if: github.event_name != 'pull_request'
deploy:
name: Deploy API Docker image
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'pull_request'
permissions:
id-token: write
steps:
- name: Authenticate to Google Cloud
id: "auth"
uses: google-github-actions/auth@v1
with:
workload_identity_provider: projects/153655225733/locations/global/workloadIdentityPools/github-actions-identity-pool/providers/github-actions-oidc-provider
service_account: "[email protected]"
token_format: "access_token"
create_credentials_file: false
- name: Log In to Artifact Registry
uses: docker/login-action@v2
with:
registry: asia-northeast1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: image
path: /tmp
- name: Load Docker image
run: docker load -i /tmp/image.tar
- name: Push to Artifact Registry
run: docker push asia-northeast1-docker.pkg.dev/econia-0/econia-backend/api:latest