2020-04-25 16:20:59 +00:00
#!/bin/bash
2020-05-04 00:57:10 +00:00
source ~/.profile
2020-04-25 16:20:59 +00:00
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-25 16:20:59 +00:00
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/
2020-04-27 22:57:21 +00:00
JAR_DIR = " $( ls " $BUILD_DIR " | grep "release" ) "
2020-04-28 00:26:22 +00:00
CHANGELOG_FULL = " $( git log --format= %s $COMMIT_TRIM ...$COMMIT_LAST | sed ':a;N;$!ba;s/\n/\\n- /g' ) "
2020-04-28 00:11:16 +00:00
2020-04-30 00:07:22 +00:00
# delete the release in case it exists
git tag -d $CUR_VER -$COMMIT_TRIM
git push origin :refs/tags/$CUR_VER -$COMMIT_TRIM
2020-05-03 17:28:13 +00:00
sleep 2
2020-04-30 00:07:22 +00:00
2020-04-27 22:57:21 +00:00
# Upload the release
cd ~/
2020-04-28 17:09:02 +00:00
./github-release-linux-amd64 $CUR_VER -$COMMIT_TRIM $BUILD_DIR /$JAR_DIR --commit master --tag $CUR_VER -$COMMIT_TRIM --github-repository $GITHUB_RELEASE_REPOSITORY --github-access-token $GITHUB_RELEASE_ACCESS_TOKEN
2020-05-03 17:28:13 +00:00
sleep 5
2020-04-27 22:57:21 +00:00
# Send message with commit information
2020-04-28 16:48:40 +00:00
curl -H "Content-Type: application/json" -X POST -d '{"embeds": [{"title": "Download v' $CUR_VER \- $COMMIT_TRIM '","color": 10195199,"description": "[**DOWNLOAD**](https://github.com/kami-blue/nightly-releases/releases/download/' $CUR_VER \- $COMMIT_TRIM '/' ${ JAR_DIR } ')\n\n**Changelog:** \n- ' " $CHANGELOG_FULL " '\n\nDiff: [' $COMMIT_LAST '...' ${ COMMIT_TRIM } '](https://github.com/kami-blue/client/compare/' $COMMIT_LAST_FULL '...' $COMMIT_FULL ') "}]}' " $WEBHOOK "
2020-04-28 17:27:23 +00:00
cd ~/website/
git pull
2020-05-03 17:28:13 +00:00
sleep 1
2020-04-28 17:31:24 +00:00
sed -i " s|beta_jar_url:.*|beta_jar_url: https://github.com/kami-blue/nightly-releases/releases/download/ ${ CUR_VER } - ${ COMMIT_TRIM } / ${ JAR_DIR } |g " docs/_config.yml
sed -i " s|beta_ver:.*|beta_ver: v ${ CUR_VER } - ${ COMMIT_TRIM } |g " docs/_config.yml
2020-04-28 17:29:56 +00:00
git commit -a -m " bump ver to v ${ CUR_VER } - ${ COMMIT_TRIM } "
2020-04-28 17:27:23 +00:00
git push origin master