message 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. fi
  11. # send status to discord
  12. if [ "${TYPE}" == "failure" ]; then
  13. curl -X POST -H "Content-Type: application/json" --data \
  14. '{
  15. "avatar_url": "https://unavatar.now.sh/twitter/github",
  16. "embeds": [
  17. {
  18. "color": 16711680,
  19. "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"
  20. }
  21. ],
  22. "username": "Github"
  23. }' \
  24. ${DISCORD_HOOK_URL}
  25. else
  26. curl -X POST -H "Content-Type: application/json" --data \
  27. '{
  28. "avatar_url": "https://unavatar.now.sh/twitter/github",
  29. "embeds": [
  30. {
  31. "color": 1681177,
  32. "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"
  33. }
  34. ],
  35. "username": "Github"
  36. }' \
  37. ${DISCORD_HOOK_URL}
  38. fi