-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
84 lines (77 loc) · 2.76 KB
/
action.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: 'stackql-deploy'
description: 'Deploy and test stacks using stackql-deploy'
inputs:
command:
description: 'stackql-deploy command to run (`build` or `test`)'
required: true
stack_dir:
description: 'repo directory containing `stackql_manifest.yml` and `resources` dir'
required: true
stack_env:
description: 'environment to deploy or test (e.g., `dev`, `prod`)'
required: true
env_vars:
description: 'environment variables or secrets imported into a stack (format: `KEY=value,KEY2=value2`)'
required: false
env_file:
description: 'environment variables sourced from a file'
required: false
show_queries:
description: 'show queries run in the output logs'
required: false
log_level:
description: 'set the logging level (`INFO` or `DEBUG`, defaults to `INFO`)'
required: false
dry_run:
description: 'perform a dry run of the operation'
required: false
custom_registry:
description: 'custom registry URL to be used for stackql'
required: false
on_failure:
description: 'action on failure'
required: false
runs:
using: 'composite'
steps:
- name: Install Python
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Install stackql-deploy
shell: bash
run: pip install -q stackql-deploy pyyaml || { echo "pip install failed"; exit 1; }
- name: Run stackql-deploy
shell: bash
run: |
ENV_OPTS=""
if [ -n "${{ inputs.env_vars }}" ]; then
IFS=',' read -r -a env_array <<< "${{ inputs.env_vars }}"
for env_var in "${env_array[@]}"; do
ENV_OPTS+=" -e $env_var"
done
fi
STACKQL_DEPLOY_CMD="stackql-deploy ${{ inputs.command }} ${{ inputs.stack_dir }} ${{ inputs.stack_env }}"
if [ -n "${{ inputs.env_file }}" ]; then
STACKQL_DEPLOY_CMD+=" --env-file ${{ inputs.env_file }}"
fi
if [ "${{ inputs.show_queries }}" == "true" ]; then
STACKQL_DEPLOY_CMD+=" --show-queries"
fi
if [ -n "${{ inputs.log_level }}" ]; then
STACKQL_DEPLOY_CMD+=" --log-level ${{ inputs.log_level }}"
fi
if [ "${{ inputs.dry_run }}" == "true" ]; then
STACKQL_DEPLOY_CMD+=" --dry-run"
fi
if [ -n "${{ inputs.custom_registry }}" ]; then
STACKQL_DEPLOY_CMD+=" --custom-registry ${{ inputs.custom_registry }}"
fi
if [ -n "${{ inputs.on_failure }}" ]; then
STACKQL_DEPLOY_CMD+=" --on-failure ${{ inputs.on_failure }}"
fi
echo "executing: $STACKQL_DEPLOY_CMD $ENV_OPTS"
$STACKQL_DEPLOY_CMD $ENV_OPTS
branding:
icon: 'server'
color: 'blue'