Skip to content

Commit

Permalink
deployment file
Browse files Browse the repository at this point in the history
  • Loading branch information
jmesterh committed Sep 4, 2024
1 parent eaffcd9 commit ddf8b7b
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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

0 comments on commit ddf8b7b

Please sign in to comment.