kami-blue/scripts/hook.sh

27 lines
1.4 KiB
Bash
Raw Normal View History

2020-03-10 22:31:43 +00:00
#!/bin/bash
2020-03-11 03:12:34 +00:00
if [[ "$TRAVIS_PULL_REQUEST" == "true" ]]; then exit 0; else echo "">/dev/null; fi
COMMIT_TRIM="${TRAVIS_COMMIT::7}"
COMMIT_MSG="$TRAVIS_COMMIT_MESSAGE"
2020-03-11 02:55:55 +00:00
if [[ "$BRANCH" == "feature/master" ]]; then
# Send message with branch name
2020-03-11 14:52:06 +00:00
curl -H "Content-Type: application/json" -X POST -d '{"embeds": [{"title": "","description": "**Changelog:** '"$COMMIT_MSG"'\nBranch: `'"$BRANCH"'`\nCommit: ['${COMMIT_TRIM}'](https://github.com/S-B99/kamiblue/commits/'${COMMIT_TRIM}') Full: ['${COMMIT_TRIM}'-](https://github.com/S-B99/kamiblue/commits/'${TRAVIS_COMMIT}') "}]}' "$WEBHOOK"
2020-03-10 22:31:43 +00:00
2020-03-11 02:55:55 +00:00
# Upload the release file
BUILD_DIR="$(readlink -f ./build/libs/)"
JAR_DIR="$(ls "$BUILD_DIR" | grep "release")"
curl -F content=@"$BUILD_DIR/$JAR_DIR" "$WEBHOOK"
elif [[ "$BRANCH" == "feature/safecrystal#480" ]]; then
# Send message with branch name
2020-03-11 14:52:06 +00:00
curl -H "Content-Type: application/json" -X POST -d '{"embeds": [{"title": "","description": "**Changelog:** '"$COMMIT_MSG"'\nBranch: `'"$BRANCH"'`\nCommit: ['${COMMIT_TRIM}'](https://github.com/S-B99/kamiblue/commits/'${COMMIT_TRIM}') Full: ['${COMMIT_TRIM}'-](https://github.com/S-B99/kamiblue/commits/'${TRAVIS_COMMIT}') "}]}' "$WEBHOOK"
2020-03-11 02:55:55 +00:00
# Upload the release file
BUILD_DIR="$(readlink -f ./build/libs/)"
JAR_DIR="$(ls "$BUILD_DIR" | grep "release")"
curl -F content=@"$BUILD_DIR/$JAR_DIR" "$WEBHOOK"
else
exit 0
fi