Skip to content

Merge pull request #14 from sfc-gh-vraudszus/main #9

Merge pull request #14 from sfc-gh-vraudszus/main

Merge pull request #14 from sfc-gh-vraudszus/main #9

name: Deploy data pipeline
# Action will run on pushes to selected branches
on:
push:
branches:
- dev
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
env:
REPO_NAME: "quickstart_common.public.quickstart_repo"
# Read connection secrets
SNOWFLAKE_CONNECTIONS_DEFAULT_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_CONNECTIONS_DEFAULT_USER: ${{ secrets.SNOWFLAKE_USER }}
SNOWFLAKE_CONNECTIONS_DEFAULT_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
steps:
# Checkout step is necessary if you want to use a config file from your repo
- name: Checkout repository
uses: actions/checkout@v4
# Install Snowflake CLI GitHub Action and point to config file
- name: Install snowflake-cli
uses: Snowflake-Labs/[email protected]
with:
cli-version: "latest"
default-config-file-path: ".snowflake/config.toml"
# Update Snowflake's copy of the repository
- name: Fetch repository changes
run: snow git fetch "${REPO_NAME}"
# Deploy pipeline with branch specific parameters
- name: Deploy data pipeline to ${{ github.ref_name }}
run: |
BRANCH_NAME=${{ github.ref_name }}
if [ "${BRANCH_NAME}" == "main" ]; then
RETENTION_TIME=1
else
RETENTION_TIME=0
fi
snow git execute \
"@${REPO_NAME}/branches/${BRANCH_NAME}/steps/0[134]_*" \
-D "environment='${BRANCH_NAME}'" \
-D "retention_time=${RETENTION_TIME}"