deploy using snowflake-cli #31
This file contains hidden or 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 using snowflake-cli | |
# Trigger on demand | |
on: | |
workflow_dispatch: | |
jobs: | |
version: | |
name: "Deploy Streamlit App from Github Actions using SnowCLI GA" | |
runs-on: ubuntu-latest | |
env: | |
SNOW_SQL_ACCOUNT: ${{ secrets.SNOW_SQL_ACCOUNT}} | |
SNOW_SQL_USER: ${{ secrets.SNOW_SQL_USER }} | |
PRIVATE_KEY_PASSPHRASE: ${{ secrets.SNOWSQL_PRIVATE_KEY_PASSPHRASE }} | |
SNOWSQL_PRIVATE_KEY: ${{ secrets.SNOW_SQL_PRIVATE_KEY }} | |
steps: | |
# Checkout step is necessary if you want to use a config file from your repo | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
# Write SNOWSQL_PRIVATE_KEY to a file | |
- name: Write private key | |
run: echo "$SNOWSQL_PRIVATE_KEY" > private_key.pem | |
# Snowflake CLI installation | |
- uses: Snowflake-Labs/[email protected] | |
with: | |
cli-version: "latest" | |
default-config-file-path: 'config.toml' # root of the repository | |
# Now lets test the connection with snow command | |
- name: Test connection | |
shell: bash | |
run: | | |
snow --version | |
snow connection list | |
snow connection test --connection cicd --private-key-path private_key.pem --account $SNOW_SQL_ACCOUNT --user $SNOW_SQL_USER --authenticator SNOWFLAKE_JWT --database STREAMLIT_DB --schema PUBLIC | |
- name: Deploy | |
working-directory: snowobjects/streamlit/app1/demo_st_app | |
shell: bash | |
run: | | |
ls -l | |
snow streamlit deploy --replace --connection cicd --private-key-path $GITHUB_WORKSPACE/private_key.pem --account $SNOW_SQL_ACCOUNT --user $SNOW_SQL_USER --authenticator SNOWFLAKE_JWT --database STREAMLIT_DB --schema PUBLIC |