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: Deploy to Snowflake | |
# This workflow is triggered on pushes to the prod branch and when there are changes in the src directory. | |
on: | |
push: | |
branches: | |
- prod | |
paths: | |
- "src/**" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.10 | |
# Install Poetry | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
# Install project dependencies using Poetry | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Deploy to Snowflake | |
run: | | |
cd src | |
for dir in */; do | |
component_type=${dir%/} | |
case $component_type in | |
task) | |
snowdev deploy --task $dir || continue | |
;; | |
streamlit) | |
snowdev deploy --streamlit $dir || continue | |
;; | |
udf) | |
snowdev deploy --udf $dir || continue | |
;; | |
sproc) | |
snowdev deploy --sproc $dir || continue | |
;; | |
esac | |
done | |
env: | |
ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} | |
USER_NAME: ${{ vars.SNOWFLAKE_USER }} | |
PASSWORD: ${{ secrets.SNOWFLAKE_PWD }} | |
ROLE: ${{ vars.SNOWFLAKE_ROLE }} | |
DATABASE: ${{ secrets.SNOWFLAKE_DATABASE }} | |
SCHEMA: ${{ vars.SNOWFLAKE_SCHEMA }} | |
WAREHOUSE: ${{ vars.SNOWFLAKE_WAREHOUSE }} | |
continue-on-error: true |