-
Notifications
You must be signed in to change notification settings - Fork 6
66 lines (55 loc) · 1.88 KB
/
build-and-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Deploy Snowpark Apps
on:
push:
branches:
- main
release:
types: [published]
workflow_dispatch:
env:
SNOWSQL_ACCOUNT: ${{ secrets.SNOWSQL_ACCOUNT }}
SNOWSQL_USER: ${{ secrets.SNOWSQL_USER }}
SNOWSQL_PWD: ${{ secrets.SNOWSQL_PWD }}
SNOWSQL_DATABASE: ${{ secrets.SNOWSQL_DATABASE }}
SNOWSQL_SCHEMA: ${{ secrets.SNOWSQL_SCHEMA }}
SNOWSQL_WAREHOUSE: ${{ secrets.SNOWSQL_WAREHOUSE }}
ARTIFACT_NAME: java-sources-${{ github.ref_name }}.jar
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'
- name: Test and build app
run: mvn package --no-transfer-progress
- name: Rename artifact with commit ID or release name
run: mv ${{ github.workspace }}/target/*.jar ${{ env.ARTIFACT_NAME }}
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: java-app-${{ github.ref_name}}
path: ${{ env.ARTIFACT_NAME }}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3 # Necessary for the resources.sql file
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: java-app-${{ github.ref_name}}
- name: Install SnowSQL
run: |
curl -O https://sfc-repo.snowflakecomputing.com/snowsql/bootstrap/1.2/linux_x86_64/snowsql-1.2.24-linux_x86_64.bash
SNOWSQL_DEST=~/snowflake SNOWSQL_LOGIN_SHELL=~/.profile bash snowsql-1.2.24-linux_x86_64.bash
- name: Deploy jobs
run: |
~/snowflake/snowsql \
-f resources.sql \
-o variable_substitution=true \
--variable artifact_name=${{ env.ARTIFACT_NAME }}