aboutsummaryrefslogtreecommitdiff
path: root/.github/actions/deploy-request/request.sh
diff options
context:
space:
mode:
Diffstat (limited to '.github/actions/deploy-request/request.sh')
-rwxr-xr-x.github/actions/deploy-request/request.sh32
1 files changed, 17 insertions, 15 deletions
diff --git a/.github/actions/deploy-request/request.sh b/.github/actions/deploy-request/request.sh
index 9002fb399..f767be262 100755
--- a/.github/actions/deploy-request/request.sh
+++ b/.github/actions/deploy-request/request.sh
@@ -3,14 +3,13 @@ set -e
REF_TO_DEPLOY="${1}"
#we are using exact SHA to deploy, and not branc (which can move)
-SHA_TO_DEPLOY="${1}"
-API_USERNAME="${2}"
-API_TOKEN="${3}"
-OUTPUT="${4}"
+SHA_TO_DEPLOY="${2}"
+API_USERNAME="${3}"
+API_TOKEN="${4}"
+OUTPUT="${5}"
-TEMP_FOLDER="/tmp/${OUTPUT}"
-rm -rf "${TEMP_FOLDER}" || true
-mkdir -p "${TEMP_FOLDER}"
+rm -rf "${OUTPUT}" || true
+mkdir -p "${OUTPUT}"
function deployment_request() {
echo "making request to: ${1}"
@@ -21,10 +20,18 @@ function deployment_request() {
--arg jsonDescription "${2}" \
'{ ref: $jsonRef, task: "deploy", auto_merge: false, environment: $jsonDeployTarget, description: $jsonDescription, required_contexts: [ "push-ready" ] }' )
- local JSON_FILENAME="${TEMP_FOLDER}/deployment_request_${1}.json"
+ local JSON_FILENAME="${OUTPUT}/deployment_request_${1}.json"
echo "${JSON_TEXT}" > "${JSON_FILENAME}"
-
- curl -u "${API_USERNAME}:${API_TOKEN}" -o "${TEMP_FOLDER}/deployment_response_${1}.json" -d "@${JSON_FILENAME}" https://api.github.com/repos/AnySoftKeyboard/AnySoftKeyboard/deployments
+ cat "${JSON_FILENAME}"
+ set +e
+ curl --fail -u "${API_USERNAME}:${API_TOKEN}" -o "${OUTPUT}/deployment_response_${1}.json" -d "@${JSON_FILENAME}" https://api.github.com/repos/AnySoftKeyboard/AnySoftKeyboard/deployments
+ local curl_exit_code=$?
+ set -e
+ echo "response with exit-code ${curl_exit_code}:"
+ cat "${OUTPUT}/deployment_response_${1}.json"
+ if [[ ${curl_exit_code} -ne 0 ]]; then
+ exit ${curl_exit_code}
+ fi
}
#some deploy logic
@@ -34,8 +41,3 @@ if [[ "${REF_TO_DEPLOY}" == "refs/heads/master" ]]; then
elif [[ "${REF_TO_DEPLOY}" == "release-branch-v"* ]]; then
deployment_request "app_beta" "Deployment request by ${API_USERNAME}"
fi
-
-rm -rf "${OUTPUT}" || true
-mkdir -p "${OUTPUT}"
-
-mv "${TEMP_FOLDER}" "${OUTPUT}"