Example - Prod_DBT_Schedule.yml

 
name: DBT_prod_scheduled_workflow
 
# Controls when the action will run. 
on:
  # Triggers the workflow every day at 23:00 UTC
  schedule:
    # * is a special character in YAML so you have to quote this string
    - cron:  '0 23 * * *'
 
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:
    inputs:
      name:
        description: 'Reason for Manual Trigger'
        required: true
        default: 'Custom re-run'
# Environment variable values are retrived from Github secrets
env:
  DBT_TARGET:            PROD
  DBT_SNOWFLAKE_ACCOUNT: ${{ secrets.DBT_SNOWFLAKE_ACCOUNT }}
  DBT_USER:              ${{ secrets.DBT_PROD_USER }}
  DBT_PASSWORD:          ${{ secrets.DBT_PROD_PASSWORD }}
  DBT_ROLE:              PROD_TRANSFORMER
  DBT_DB:                ONEDB
  DBT_SCHEMA:            ANALYTICS
  DBT_WH:                PROD_TRANSFORMER_WH
 
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
 
    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      - name: Event info
        run: |
          echo This workflow on ${{ github.repository }} was started by ${{ github.actor }} from the event ${{ github.event_name }} and action ${{github.event.action}}
          
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - name: Checkout branch
        uses: actions/checkout@v3
 
      - name: Install Python 3.8
        uses: actions/setup-python@v4
        with:
          python-version: 3.8
 
      - name: Install DBT
        run: |
          python -m pip install --upgrade pip
          pip install dbt-snowflake==1.6.0
          
      - name: Install dbt dependency packages
        run: |
          dbt deps
 
      - name: Deploy the models in example folder
        run: |
          dbt run --model tag:daily --vars '{"batch_name":"DailyBatch"}' --profiles-dir ./dbt_profiles
 
name: DBT_prod_scheduled_workflow
 
# Controls when the action will run. 
on:
  # Triggers the workflow every day at 23:00 UTC
  schedule:
    # * is a special character in YAML so you have to quote this string
    - cron:  '0 23 * * *'
 
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:
    inputs:
      name:
        description: 'Reason for Manual Trigger'
        required: true
        default: 'Custom re-run'
# Environment variable values are retrived from Github secrets
env:
  DBT_TARGET:            PROD
  DBT_SNOWFLAKE_ACCOUNT: ${{ secrets.DBT_SNOWFLAKE_ACCOUNT }}
  DBT_USER:              ${{ secrets.DBT_PROD_USER }}
  DBT_PASSWORD:          ${{ secrets.DBT_PROD_PASSWORD }}
  DBT_ROLE:              PROD_TRANSFORMER
  DBT_DB:                ONEDB
  DBT_SCHEMA:            ANALYTICS
  DBT_WH:                PROD_TRANSFORMER_WH
 
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
 
    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      - name: Event info
        run: |
          echo This workflow on ${{ github.repository }} was started by ${{ github.actor }} from the event ${{ github.event_name }} and action ${{github.event.action}}
          
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - name: Checkout branch
        uses: actions/checkout@v3
 
      - name: Install Python 3.8
        uses: actions/setup-python@v4
        with:
          python-version: 3.8
 
      - name: Install DBT
        run: |
          python -m pip install --upgrade pip
          pip install dbt-snowflake==1.6.0
          
      - name: Install dbt dependency packages
        run: |
          dbt deps
 
      - name: Deploy the models in example folder
        run: |
          dbt run --model tag:daily --vars '{"batch_name":"DailyBatch"}' --profiles-dir ./dbt_profiles