Skip to content

deployment file

deployment file #1

Workflow file for this run

name: Deployment
on:
push:
branches:
- development
jobs:
deployment:
runs-on: ubuntu-latest
environment: ${{ vars.GITHUB_REF_NAME }}
concurrency: ${{ vars.GITHUB_REF_NAME }}
env:
REGISTRY: ${{ vars.REGISTRY }}
IMAGE: ${{ secrets.REPOSITORY }}/mirc-ctp
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/checkout@v4
- name: Authenticate with Google Cloud
uses: google-github-actions/auth@v2
with:
project_id: ${{ secrets.WORKLOAD_IDENTITY_PROJECT }}
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
- name: Configure docker for Google artifact registry
id: docker
run: |
gcloud auth configure-docker ${{ env.REGISTRY }}
branch=${GITHUB_REF##*/}
ts=$(date +%Y%m%d%H%M%S)
echo "BUILD_ID=${branch}-${ts}" >> $GITHUB_OUTPUT
echo "BRANCH_NAME=${branch}" >> $GITHUB_OUTPUT
- name: Setup buildx so we can use GHA caching
uses: docker/setup-buildx-action@v3
- name: Build and push image
uses: docker/build-push-action@v6
with:
build-args: |
DBT_TARGET=${{ github.ref == 'refs/heads/main' && 'prod' || 'reg' }}
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ steps.docker.outputs.BUILD_ID }}
${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}
${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ steps.docker.outputs.BRANCH_NAME }}
${{ env.REGISTRY }}/${{ env.IMAGE }}:latest