2020-04-28 01:27:44 +00:00
|
|
|
#!/bin/bash
|
2020-04-29 21:50:50 +00:00
|
|
|
|
|
|
|
# REQUIREMENTS:
|
|
|
|
#
|
|
|
|
# ~/.profile:
|
|
|
|
# $GITHUB_RELEASE_ACCESS_TOKEN with repo:status, repo_deployment, public_repo
|
|
|
|
# $GITHUB_RELEASE_REPOSITORY="kami-blue/nightly-releases"
|
|
|
|
# $WEBHOOK= webhook url
|
|
|
|
#
|
|
|
|
# ~/kamiblue
|
|
|
|
# git clone git@github.com:kami-blue/nightly-releases.git
|
|
|
|
# git remote add kamiblue git@github.com:kami-blue/client.git
|
|
|
|
#
|
|
|
|
# ~/Java JDK 8 is also required
|
|
|
|
#
|
|
|
|
# ~/https://github.com/buildkite/github-release/releases is also required
|
|
|
|
#
|
|
|
|
# crontab -e
|
|
|
|
# 0 0,12 * * * /home/user/releaseNightly >/tmp/cron1.log 2>&1
|
|
|
|
|
2020-04-28 01:27:44 +00:00
|
|
|
cd ~/kamiblue/
|
|
|
|
export COMMIT_LAST="$(git log --format=%h -1)"
|
2020-04-28 16:48:54 +00:00
|
|
|
export COMMIT_LAST_FULL="$(git log --format=%H -1)"
|
|
|
|
|
|
|
|
git fetch kamiblue master
|
|
|
|
git fetch origin master
|
2020-05-03 17:26:26 +00:00
|
|
|
|
|
|
|
sleep 0.5
|
|
|
|
|
2020-04-28 01:27:44 +00:00
|
|
|
git reset --hard kamiblue/master
|
2020-04-28 17:04:52 +00:00
|
|
|
git push --force origin HEAD:master
|
2020-04-28 01:27:44 +00:00
|
|
|
|
2020-05-03 17:26:26 +00:00
|
|
|
sleep 1
|
|
|
|
|
2020-04-28 01:27:44 +00:00
|
|
|
export COMMIT_TRIM="$(git log --format=%h -1)"
|
|
|
|
|
2020-04-29 21:50:50 +00:00
|
|
|
if [[ "$COMMIT_LAST" == "$COMMIT_TRIM" ]]; then
|
2020-04-28 01:27:44 +00:00
|
|
|
exit 0
|
2020-04-28 16:48:54 +00:00
|
|
|
fi
|
2020-04-29 21:50:50 +00:00
|
|
|
|
2020-04-28 01:27:44 +00:00
|
|
|
rm -rf build/libs
|
|
|
|
|
|
|
|
./scripts/preHook.sh
|
2020-05-03 17:26:26 +00:00
|
|
|
sleep 1
|
2020-04-28 01:27:44 +00:00
|
|
|
./gradlew build
|
2020-05-03 17:26:26 +00:00
|
|
|
sleep 2
|
|
|
|
./scripts/hook.sh
|