Skip to content

Merge pull request #4 from mindvalley/feat/swich-to-gar #4

Merge pull request #4 from mindvalley/feat/swich-to-gar

Merge pull request #4 from mindvalley/feat/swich-to-gar #4

Workflow file for this run

name: Build and Push to GAR
on:
push:
branches:
- "main"
env:
GAR_PROJECT_ID: mv-auxiliary
GAR_REPO: prometheus-bigquery-exporter
GAR_PROJECT_NAMESPACE: prometheus-bigquery-exporter
permissions:
contents: read
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Git repository
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v2
with:
token_format: access_token
workload_identity_provider: ${{ secrets.GCP_WIP }}
service_account: ${{ secrets.GCP_SA_EMAIL }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Login to GAR
uses: docker/login-action@v3
with:
registry: asia-southeast1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- uses: docker/metadata-action@v5
id: metadata
with:
images: |
asia-southeast1-docker.pkg.dev/${{ env.GAR_PROJECT_ID}}/${{ env.GAR_REPO}}/${{ env.GAR_PROJECT_NAMESPACE }}
tags: |
type=ref,event=branch
type=ref,event=pr
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build using Docker
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
file: Dockerfile