Skip to content

Instantly share code, notes, and snippets.

@vrumger
Last active August 20, 2020 00:35
Show Gist options
  • Save vrumger/17ed3dd888af1e608f6e66b41054abe5 to your computer and use it in GitHub Desktop.
Save vrumger/17ed3dd888af1e608f6e66b41054abe5 to your computer and use it in GitHub Desktop.
set -euo pipefail
run_cmd() {
echo "$ $@"
"$@"
echo
}
run_cmd git checkout .
run_cmd git pull
run_cmd rm -rf build/ dist/
[ ! -d node_modules ] && run_cmd npm i
run_cmd npm run build
version=$(jq -r .version package.json)
platform=$(uname -s | tr "[:upper:]" "[:lower:]")
file_name="$platform-$version.zip"
[ -f "$file_name" ] && run_cmd rm "$file_name"
run_cmd zip -r "$file_name" dist/
run_cmd scp "$file_name" user@server:/path/to/disstreamchat
case "$platform" in
linux) md5cmd="md5sum" ;;
darwin) md5cmd="md5" ;;
*) exit 1 ;;
esac
message="https://example.com/disstreamchat/$file_name"$'\n```console\n'"$(run_cmd $md5cmd "$file_name")"$'\n```'
curl -X POST \
-H "Content-Type: application/json" \
-d "$(jq -Mcn --arg content "$message" '{content: $content}')" \
https://discordapp.com/api/webhooks/...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment