kami-blue/scripts/hook.sh

23 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/bash
CUR_VER="$(tail -c +2 ./scripts/curVer)"
2020-04-27 16:28:30 +00:00
COMMIT_TRIM="$(git log --format=%h -1)"
COMMIT_FULL="$(git log --format=%H -1)"
COMMIT_MSG="$(git log --format=%s -1)"
2020-04-27 01:59:49 +00:00
# Find the release file and rename it to kamiblue-version-commit-release.jar
2020-04-27 23:12:34 +00:00
BUILD_DIR=$HOME/kamiblue/build/libs/
JAR_DIR="$(ls "$BUILD_DIR" | grep $COMMIT_TRIM-"release")"
2020-04-27 22:57:21 +00:00
mv ${BUILD_DIR}/${JAR_DIR} ${BUILD_DIR}/kamiblue-${CUR_VER}-${COMMIT_TRIM}-release.jar
JAR_DIR="$(ls "$BUILD_DIR" | grep "release")"
2020-04-27 01:59:49 +00:00
# Upload the release file
#curl -F content=@"$BUILD_DIR/$JAR_DIR" "$WEBHOOK"
2020-04-27 22:57:21 +00:00
# Upload the release
cd ~/
2020-04-27 23:12:34 +00:00
source ~/.profile
./github-release-linux-amd64 $CUR_VER-$COMMIT_TRIM $BUILD_DIR/$JAR_DIR --github-access-token $GITHUB_RELEASE_ACCESS_TOKEN --github-repository $GITHUB_RELEASE_REPOSITORY
2020-04-27 22:57:21 +00:00
# Send message with commit information
2020-04-27 23:36:06 +00:00
curl -H "Content-Type: application/json" -X POST -d '{"embeds": [{"title": "Download '$CUR_VER\-$COMMIT_TRIM'","color": 10195199,"description": "**Download:** ['${CUR_VER}\-${COMMIT_TRIM}'](https://github.com/kami-blue/nightly-releases/releases/download/'$CUR_VER\-$COMMIT_TRIM'/'${JAR_DIR}')\n**Changelog:** '"$COMMIT_MSG"'\nCommit: ['${COMMIT_TRIM}'](https://github.com/kami-blue/client/commits/'${COMMIT_TRIM}') Direct: ['${COMMIT_TRIM}'](https://github.com/kami-blue/client/commit/'${COMMIT_FULL}') "}]}' "$WEBHOOK"