forked from bitrise-io/appetize-deploy-step
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep.sh
executable file
·51 lines (40 loc) · 1.52 KB
/
step.sh
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
#!/bin/bash
THIS_SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Download the binary
wget "https://github.com/dag-io/appetize-deploy/releases/download/0.1.6/appetize-deploy.phar" -P $THIS_SCRIPTDIR -q
source "${THIS_SCRIPTDIR}/_bash_utils/utils.sh"
source "${THIS_SCRIPTDIR}/_bash_utils/formatted_output.sh"
# init / cleanup the formatted output
echo "" > "${formatted_output_file_path}"
if [ -z "${app_path}" ] ; then
write_section_to_formatted_output "# Error"
write_section_start_to_formatted_output '* Required input `$app_path` not provided!'
exit 1
fi
if [ -z "${platform}" ] ; then
write_section_to_formatted_output "# Error"
write_section_start_to_formatted_output '* Required input `$platform` not provided!'
exit 1
fi
if [ -z "${appetize_token}" ] ; then
write_section_to_formatted_output "# Error"
write_section_start_to_formatted_output '* Required input `$appetize_token` not provided!'
exit 1
fi
if [ -z "${protected_by_account}" ] ; then
write_section_to_formatted_output "# Error"
write_section_start_to_formatted_output '* Required input `$protected_by_account` not provided!'
exit 1
fi
resp=$(php "${THIS_SCRIPTDIR}/appetize-deploy.phar")
ex_code=$?
if [ ${ex_code} -eq 0 ] ; then
echo "${resp}"
write_section_to_formatted_output "# Success"
echo_string_to_formatted_output "Build successfully deployed."
exit 0
fi
write_section_to_formatted_output "# Error"
write_section_to_formatted_output "Deploying the build failed with the following error:"
echo_string_to_formatted_output "${resp}"
exit 1