1
0

message 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. set -e
  3. TYPE=$1
  4. if [ "${TYPE}" == "dev-push" ]; then
  5. BOOT_URL="https://s3.amazonaws.com/dev.boot.netboot.xyz/${GITHUB_SHA}/index.html"
  6. elif [ "${TYPE}" == "rc-push" ]; then
  7. BOOT_URL="https://staging.boot.netboot.xyz/$(cat version.txt)-RC/index.html"
  8. elif [ "${TYPE}" == "live-push" ]; then
  9. BOOT_URL="https://boot.netboot.xyz/$(cat version.txt)/index.html"
  10. elif [ "${TYPE}" == "rolling-push" ]; then
  11. BOOT_URL="https://boot.netboot.xyz/index.html"
  12. fi
  13. # send status to discord
  14. if [ "${TYPE}" == "failure" ]; then
  15. curl -X POST -H "Content-Type: application/json" --data \
  16. '{
  17. "avatar_url": "https://api.microlink.io/?url=https://twitter.com/github&embed=image.url",
  18. "embeds": [
  19. {
  20. "color": 16711680,
  21. "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"
  22. }
  23. ],
  24. "username": "Github"
  25. }' \
  26. ${DISCORD_HOOK_URL}
  27. else
  28. curl -X POST -H "Content-Type: application/json" --data \
  29. '{
  30. "avatar_url": "https://api.microlink.io/?url=https://twitter.com/github&embed=image.url",
  31. "embeds": [
  32. {
  33. "color": 1681177,
  34. "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"
  35. }
  36. ],
  37. "username": "Github"
  38. }' \
  39. ${DISCORD_HOOK_URL}
  40. fi