snowflake-devops-demo #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: snowflake-devops-demo | |
# Controls when the action will run. | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'migrations/**' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
deploy-snowflake-changes-job: | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Use Python 3.8.x | |
uses: actions/[email protected] | |
with: | |
python-version: 3.8.x | |
- name: Installing schemachange | |
run: | | |
python --version | |
echo "Step 1: Installing schemachange" | |
pip install schemachange | |
- name: Run schemachange | |
env: | |
SF_ACCOUNT: ${{ secrets.SF_ACCOUNT }} | |
SF_USERNAME: ${{ secrets.SF_USERNAME }} | |
SF_ROLE: ${{ secrets.SF_ROLE }} | |
SF_WAREHOUSE: ${{ secrets.SF_WAREHOUSE }} | |
SF_DATABASE: ${{ secrets.SF_DATABASE }} | |
SF_SCHEMA: ${{ secrets.SF_SCHEMA }} | |
SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }} | |
run: | | |
echo "Step 2: Running schemachange" | |
echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE" | |
schemachange deploy \ | |
--verbose \ | |
-f $GITHUB_WORKSPACE/migrations \ | |
-a $SF_ACCOUNT \ | |
-u $SF_USERNAME \ | |
-r $SF_ROLE \ | |
-w $SF_WAREHOUSE \ | |
-d $SF_DATABASE \ | |
-s $SF_SCHEMA \ | |
-c $SF_DATABASE.SCHEMACHANGE.CHANGE_HISTORY \ | |
--create-change-history-table |