diff options
author | red031000 <rubenru09@aol.com> | 2020-12-23 19:21:52 +0000 |
---|---|---|
committer | red031000 <rubenru09@aol.com> | 2020-12-23 19:35:03 +0000 |
commit | 7dfef0140ad1b09d7091ffc2db958a0c00b8f215 (patch) | |
tree | dd435156c60557115b92680c81d9a544487fada0 /.github/calcrom/webhook.sh | |
parent | bbb1fac16bc7e912410b3dc7bbfc5d3067ac19d4 (diff) |
initial try of github actions instead of travis
Diffstat (limited to '.github/calcrom/webhook.sh')
-rw-r--r-- | .github/calcrom/webhook.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/.github/calcrom/webhook.sh b/.github/calcrom/webhook.sh new file mode 100644 index 00000000..fd12b64f --- /dev/null +++ b/.github/calcrom/webhook.sh @@ -0,0 +1,19 @@ +#!/bin/bash -ex + +# Only run this script if it's the master branch build. +if [[ "$GITHUB_REF" != "refs/head/master" || "$GITHUB_EVENT_NAME" != "push" ]]; then + exit 0 +fi + +build_name=$1 +url=$2 +map_file=$(dirname "$0")/../../arm9/build/diamond.us/arm9.elf.xMAP +if [ ! -f $map_file ]; then + echo "$map_file does not exist!" + exit 1 +fi + +make -C ${GITHUB_WORKSPACE}/.github/calcrom +output=$(${GITHUB_WORKSPACE}/.github/calcrom/calcrom ${GITHUB_WORKSPACE} | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g') +curl -d "{\"username\": \"$CALCROM_DISCORD_WEBHOOK_USERNAME\", \"avatar_url\": \"$url\", \"content\":\"\`\`\`$build_name progress:\\n$output\`\`\`\"}" -H "Content-Type: application/json" -X POST $CALCROM_DISCORD_WEBHOOK_URL +popd |