ci-scripts/webhooks/webhook-amogusspecialsauce.sh

45 lines
948 B
Bash
Raw Normal View History

#!/bin/bash
# Script for webhook artifacts from build-env
# Needs following env:
# DRONE_COMMIT_SHA
# DRONE_TAG
# WEBHOOK_URL
if [[ -n "${DRONE_TAG}" ]]; then
message=$(cat <<EOF
{
"content": null,
"embeds": [
{
"title": "CI-Status AmogusSpecialSauce (prod-build)",
"description": "Download artifacts (valid 90D from now):\nhttps://s3.hackmi.ch/amogusspecialsauce/releases/compiled-${DRONE_TAG}.zip",
"color": 65321
}
],
"attachments": []
}
EOF
)
elif [[ -n "${DRONE_COMMIT_SHA}" ]]; then
message=$(cat <<EOF
{
"content": null,
"embeds": [
{
"title": "CI-Status AmogusSpecialSauce (main-build)",
"description": "Download artifacts (valid 90D from now):\nhttps://s3.hackmi.ch/amogusspecialsauce/b/main/compiled-${DRONE_COMMIT_SHA:0:10}.zip",
"color": 65321
}
],
"attachments": []
}
EOF
)
else
exit 1
fi
curl -d "${message}" -H "Content-Type: application/json" "${WEBHOOK_URL}"