kami-blue/scripts/hook.sh

23 lines
1.1 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
2020-04-05 12:43:07 +00:00
CUR_VER="$(cat ./scripts/curVer)"
2020-04-05 12:47:39 +00:00
CUR_VER="${CUR_VER:1}"
COMMIT_TRIM="${TRAVIS_COMMIT::7}"
COMMIT_MSG="$TRAVIS_COMMIT_MESSAGE"
if [[ "$BRANCH" == "master" ]]; then
2020-03-11 02:55:55 +00:00
# Send message with branch name
2020-04-04 08:41:52 +00:00
curl -H "Content-Type: application/json" -X POST -d '{"embeds": [{"title": "","color": 10195199,"description": "**Changelog:** '"$COMMIT_MSG"'\nBranch: `'"$BRANCH"'`\nCommit: ['${COMMIT_TRIM}'](https://github.com/kami-blue/client/commits/'${COMMIT_TRIM}') Direct: ['${COMMIT_TRIM}'](https://github.com/kami-blue/client/commit/'${TRAVIS_COMMIT}') "}]}' "$WEBHOOK"
2020-03-10 22:31:43 +00:00
2020-04-05 12:43:07 +00:00
# Find the release file and rename it to kamiblue-version-commit-release.jar
2020-03-11 02:55:55 +00:00
BUILD_DIR="$(readlink -f ./build/libs/)"
JAR_DIR="$(ls "$BUILD_DIR" | grep "release")"
2020-04-05 12:43:07 +00:00
mv ${BUILD_DIR}/${JAR_DIR} ${BUILD_DIR}/kamiblue-${CUR_VER}-${COMMIT_TRIM}-release.jar
JAR_DIR="$(ls "$BUILD_DIR" | grep "release")"
# Upload the release file
2020-04-05 10:51:45 +00:00
curl -F content=@"$BUILD_DIR/$JAR_DIR" "$WEBHOOK"
2020-03-11 02:55:55 +00:00
else
exit 0
2020-04-04 21:06:01 +00:00
fi