feat(build): add github status jobs (fixes #28)
This commit is contained in:
parent
8452b7384c
commit
c8b2abc110
|
@ -70,6 +70,7 @@ build-gui-bundle:
|
|||
- cd gui
|
||||
- make ci
|
||||
|
||||
# packages, various
|
||||
.package-api-oci:
|
||||
extends:
|
||||
- .build-oci
|
||||
|
@ -146,6 +147,7 @@ package-gui-oci-node-buster:
|
|||
IMAGE_ARCH: node-buster
|
||||
IMAGE_FILE: Containerfile.node.buster
|
||||
|
||||
# language-specific packages
|
||||
package-api-twine:
|
||||
extends:
|
||||
- .build-node
|
||||
|
@ -171,3 +173,27 @@ package-gui-npm:
|
|||
script:
|
||||
- cd gui
|
||||
- npm publish
|
||||
|
||||
# commit status
|
||||
github-pending:
|
||||
stage: status-pre
|
||||
extends:
|
||||
- .build-curl
|
||||
script:
|
||||
- ./common/scripts/github-status.sh pending
|
||||
|
||||
github-failure:
|
||||
stage: status-post
|
||||
extends:
|
||||
- .build-curl
|
||||
when: on_failure
|
||||
script:
|
||||
- ./common/scripts/github-status.sh failure
|
||||
|
||||
github-success:
|
||||
stage: status-post
|
||||
extends:
|
||||
- .build-curl
|
||||
when: on_success
|
||||
script:
|
||||
- ./common/scripts/github-status.sh success
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#! /bin/sh
|
||||
|
||||
STATUS="${1}"
|
||||
CI_COMMIT_SHA="${CI_COMMIT_SHA:-$(git rev-parse HEAD)}"
|
||||
|
||||
STATUS_BODY="$(cat <<EOF
|
||||
{
|
||||
"state": "${STATUS}",
|
||||
"target_url": "${CI_PIPELINE_URL}",
|
||||
"description": "CI pipeline ${STATUS}!",
|
||||
"context": "gitlab/build"
|
||||
}
|
||||
EOF
|
||||
)"
|
||||
|
||||
printf "Reporting status for %s...\n%s" "${CI_COMMIT_SHA}" "${STATUS_BODY}"
|
||||
printf "%s" "${STATUS_BODY}" | curl -d @- \
|
||||
-H "Authorization: token $(printf "%s" "${GITHUB_SECRET}" | base64 -d)" \
|
||||
-i "https://api.github.com/repos/${CI_PROJECT_PATH}/statuses/${CI_COMMIT_SHA}"
|
Loading…
Reference in New Issue