Make action a pure deploy status update action

This commit is contained in:
Ole Christian Lanfjæran
2019-09-04 14:47:27 +02:00
parent dce24eaa5b
commit 35f78347ea
5 changed files with 3 additions and 37 deletions

View File

@@ -10,8 +10,6 @@
BASEDIR=$(dirname "$0")
DEPLOYMENT_ID=$("${BASEDIR}"/deployment-get-id)
GITHUB_URL="https://github.com"
GITHUB_API_URL="https://api.github.com"
DEPLOY_STATE="${1}"
DEPLOY_DESC="${2}"
@@ -19,10 +17,9 @@ DEPLOY_DESC="${2}"
[ -n "${DEPLOY_DESC}" ] || DEPLOY_DESC="Deploying from GitHub Actions"
echo "Setting status to ${DEPLOY_STATE} for deployment-id '${DEPLOYMENT_ID}'"
wget -O-- -q \
--post-data '{"state":"${DEPLOY_STATE}", "target_url":"${GITHUB_URL}/${GITHUB_REPOSITORY}/actions", "description":"${DEPLOY_DESC}"}' \
-"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/deployments/${DEPLOYMENT_ID}/statuses" \
wget -O-- \
--post-data "{\"state\":\"${DEPLOY_STATE}\", \"target_url\":\"https://github.com/${GITHUB_REPOSITORY}/actions\", \"description\":\"${DEPLOY_DESC}\"}" \
--header "Authorization: token ${GITHUB_TOKEN}" \
--header "Content-Type: text/json; charset=utf-8" \
--header "Accept: application/vnd.github.flash-preview+json" \
${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/deployments/${DEPLOYMENT_ID}/statuses
https://api.github.com/repos/"${GITHUB_REPOSITORY}"/deployments/"${DEPLOYMENT_ID}"/statuses

View File

@@ -1,11 +0,0 @@
#!/bin/sh
BASEDIR=$(dirname "$0")
sh -c "$*"
RESULT=$?
if [ 0 != "${RESULT}" ];then
echo "Failed '$*'! Exit code '${RESULT}' is not equal to 0"
"${BASEDIR}"/deployment-create-status failure
exit ${RESULT}
fi

View File

@@ -1,5 +0,0 @@
#!/bin/sh
BASEDIR=$(dirname "$0")
"${BASEDIR}"/JSON.sh < "${GITHUB_EVENT_PATH}" | grep '\["deployment","environment"]' | cut -f2 | sed -e 's/^"//' -e 's/"$//'

View File

@@ -1,11 +0,0 @@
#!/bin/sh
set -e
if [ -z "$1" ] ; then
echo "Payload argument must be set. Usage: deployment-get-payload <payload>"
exit 64
fi
BASEDIR=$(dirname "$0")
_payload_field=$1
"${BASEDIR}"/JSON.sh < "${GITHUB_EVENT_PATH}" | grep "\[\"deployment\",\"payload\",\"config\",\"${_payload_field}\"]" | cut -f2 | sed -e 's/^"//' -e 's/"$//'

View File

@@ -1,4 +0,0 @@
#!/bin/sh
BASEDIR=$(dirname "$0")
"${BASEDIR}"/JSON.sh < "${GITHUB_EVENT_PATH}" | grep "\[\"deployment\",\"task\"]" | cut -f2 | sed -e 's/^"//' -e 's/"$//'