Skip to content

test deploy.yml

test deploy.yml #8

Workflow file for this run

name: Dev build image & push
on:
push:
branches: [ test ]
env:
working-directory: silverwork_dbt
jobs:
build:
name: Dockerize dbt
runs-on: ubuntu-latest
steps:
# actions/checkout MUST come before auth
- name: Checkout
uses: actions/checkout@v2
- id: auth
name: Authenticate with Google Cloud
uses: "google-github-actions/auth@v1"
with:
token_format: access_token
project_id: ${{ vars.DBT_BIGQUERY_PROJECT_ID }}
credentials_json: ${{ secrets.KEYFILE_CONTENTS }}
access_token_lifetime: 300s
- name: Login to Artifact Registry
uses: docker/login-action@v1
with:
registry: us-central1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- id: get-tag
name: Get tag
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}
- name: Build & Push Image
uses: docker/build-push-action@v4
with:
context: ${{ github.workspace }}
push: true
tags: |
${{ secrets.DBT_BIGQUERY_PROJECT_ID }}:${{ steps.get-tag.outputs.short_ref }}
${{ secrets.DBT_BIGQUERY_PROJECT_ID }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
# - name: Trigger Airflow init dag
# env:
# AIRFLOW_WEBSERVER_ENDPOINT: ${{ secrets.AIRFLOW_WEBSERVER_ENDPOINT }}
# AIRFLOW_WEBSERVER_ID: ${{ secrets.AIRFLOW_WEBSERVER_ID }}
# AIRFLOW_WEBSERVER_PASSWORD: ${{ secrets.AIRFLOW_WEBSERVER_PASSWORD }}
# AIRFLOW_DBT_INIT_DAG_ID: ${{ secrets.AIRFLOW_DBT_INIT_DAG_ID }}
# shell: bash
# run: |
# curl "$AIRFLOW_WEBSERVER_ENDPOINT/api/v1/dags/$AIRFLOW_DBT_INIT_DAG_ID/dagRuns" --user "$AIRFLOW_WEBSERVER_ID:$AIRFLOW_WEBSERVER_PASSWORD" -H 'Content-Type: application/json' -d '{}'