diff options
| author | Menny Even Danan <menny@evendanan.net> | 2020-02-07 21:41:53 +0000 |
|---|---|---|
| committer | Menny Even Danan <menny@evendanan.net> | 2020-02-07 21:41:53 +0000 |
| commit | 5aeec9850a8a072d9ba42b7cbf784612558969e5 (patch) | |
| tree | 3efda0f17c1f7d812904df86a7aab0931310abac /.github/actions | |
| parent | 3b26882751386f54b15816f4a4ee6ab871dfdc0e (diff) | |
| download | AnySoftKeyboard-5aeec9850a8a072d9ba42b7cbf784612558969e5.tar.gz AnySoftKeyboard-5aeec9850a8a072d9ba42b7cbf784612558969e5.tar.bz2 | |
deployment status update
Diffstat (limited to '.github/actions')
| -rw-r--r-- | .github/actions/deploy-status/action.yml | 36 | ||||
| -rwxr-xr-x | .github/actions/deploy-status/request.sh | 27 |
2 files changed, 63 insertions, 0 deletions
diff --git a/.github/actions/deploy-status/action.yml b/.github/actions/deploy-status/action.yml new file mode 100644 index 000000000..90c9b50d8 --- /dev/null +++ b/.github/actions/deploy-status/action.yml @@ -0,0 +1,36 @@ +name: "deployment-status" +author: "menny" +description: "updates deployment status" + +inputs: + deployment_id: + description: "deployment-id" + required: true + state: + description: "commit to deploy" + required: true + environment: + description: "environment to deploy" + required: true + api_user_name: + description: "the username to use for API calls" + required: true + api_user_token: + description: "the user API token to use for API calls" + required: true + +runs: + using: "docker" + image: "docker://menny/ndk_ask:1.13.5" + entrypoint: /bin/bash + args: + - .github/actions/deploy-status/request.sh + - ${{ inputs.deployment_id }} + - ${{ inputs.state }} + - ${{ inputs.environment }} + - ${{ inputs.api_user_name }} + - ${{ inputs.api_user_token }} + +branding: + icon: 'package' + color: 'purple' diff --git a/.github/actions/deploy-status/request.sh b/.github/actions/deploy-status/request.sh new file mode 100755 index 000000000..eb2fdab4a --- /dev/null +++ b/.github/actions/deploy-status/request.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -e + +ID="${1}" +ENVIRONMENT="${2}" +STATE="${3}" +API_USERNAME="${4}" +API_TOKEN="${5}" + +echo "making request to: ${ID} @ ${ENVIRONMENT} to state ${STATE}" +JSON_TEXT=$( jq -n \ + --arg jsonEnvironment "${ENVIRONMENT}" \ + --arg jsonState "${STATE}" \ + '{ environment: $jsonEnvironment, state: $jsonState }' ) + +JSON_FILENAME="${OUTPUT}/deployment_request.json" +echo "${JSON_TEXT}" > "${JSON_FILENAME}" +cat "${JSON_FILENAME}" +set +e +curl --fail -u "${API_USERNAME}:${API_TOKEN}" -o "${OUTPUT}/deployment_response.json" -d "@${JSON_FILENAME}" -H "Accept: application/vnd.github.flash-preview+json" "https://api.github.com/repos/AnySoftKeyboard/AnySoftKeyboard/deployments/${ID}/statuses" +curl_exit_code=$? +set -e +echo "response with exit-code ${curl_exit_code}:" +cat "${OUTPUT}/deployment_response.json" +if [[ ${curl_exit_code} -ne 0 ]]; then + exit ${curl_exit_code} +fi |
