netboot.xyz/script/message
Antony Messerli 0f1945c6c4 Update Discord notification for rolling push
Existing push was notifying release was updated when it
is really just the rolling push. Updates message to be
more accurate.
2021-10-01 08:38:07 -05:00

44 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
set -e
TYPE=$1
if [ "${TYPE}" == "dev-push" ]; then
BOOT_URL="https://s3.amazonaws.com/dev.boot.netboot.xyz/${GITHUB_SHA}/index.html"
elif [ "${TYPE}" == "rc-push" ]; then
BOOT_URL="https://staging.boot.netboot.xyz/$(cat version.txt)-RC/index.html"
elif [ "${TYPE}" == "live-push" ]; then
BOOT_URL="https://boot.netboot.xyz/$(cat version.txt)/index.html"
elif [ "${TYPE}" == "rolling-push" ]; then
BOOT_URL="https://boot.netboot.xyz/index.html"
fi
# send status to discord
if [ "${TYPE}" == "failure" ]; then
curl -X POST -H "Content-Type: application/json" --data \
'{
"avatar_url": "https://api.microlink.io/?url=https://twitter.com/github&embed=image.url",
"embeds": [
{
"color": 16711680,
"description": "__**Failed to Build**__ \n**Build:** 'https://github.com/netbootxyz/netboot.xyz/actions/runs/${GITHUB_RUN_ID}'\n**Status:** Failure\n**Change:** https://github.com/netbootxyz/netboot.xyz/commit/'${GITHUB_SHA}'\n"
}
],
"username": "Github"
}' \
${DISCORD_HOOK_URL}
else
curl -X POST -H "Content-Type: application/json" --data \
'{
"avatar_url": "https://api.microlink.io/?url=https://twitter.com/github&embed=image.url",
"embeds": [
{
"color": 1681177,
"description": "__**Boot Menu Published**__ \n**Files:** '${BOOT_URL}' \n**Build:** 'https://github.com/netbootxyz/netboot.xyz/actions/runs/${GITHUB_RUN_ID}'\n**Change:** https://github.com/netbootxyz/netboot.xyz/commit/'${GITHUB_SHA}'\n"
}
],
"username": "Github"
}' \
${DISCORD_HOOK_URL}
fi