2017-12-03 22:11:43 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -ex
|
2017-12-21 22:13:25 +00:00
|
|
|
# Requires the following packages: git, hub, docker
|
2017-12-03 22:11:43 +00:00
|
|
|
# SET THE FOLLOWING VARIABLES
|
|
|
|
USERNAME=empireproject
|
|
|
|
IMAGE=empire
|
2017-12-23 22:41:41 +00:00
|
|
|
VERSION="$(cat VERSION)"
|
2017-12-03 22:11:43 +00:00
|
|
|
|
|
|
|
# UPDATE THE SOURCE CODE
|
|
|
|
git pull
|
|
|
|
|
2017-12-21 22:11:51 +00:00
|
|
|
# bump version
|
2017-12-23 22:41:41 +00:00
|
|
|
read -p "[!] Do you want to BUMP the version? [Y/N] " -n 1 -r
|
|
|
|
echo # (optional) move to a new line
|
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
|
|
|
then
|
|
|
|
# do dangerous stuff
|
|
|
|
# TODO: CHECK IF WE WANT TO BUMP PATCH or MINOR or MAJOR
|
|
|
|
docker run --rm -v "$PWD":/app treeder/bump minor
|
|
|
|
fi
|
2017-12-21 22:11:51 +00:00
|
|
|
VERSION=`cat VERSION`
|
2017-12-23 22:41:41 +00:00
|
|
|
echo "[*] Current version: $VERSION"
|
2017-12-21 22:11:51 +00:00
|
|
|
|
|
|
|
# TAF, PULL, MERGE DEV
|
2017-12-23 22:41:41 +00:00
|
|
|
read -p "[!] Do you want to create a new Github Release? [Y/N] " -n 1 -r
|
|
|
|
echo # (optional) move to a new line
|
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
|
|
|
then
|
|
|
|
# do dangerous stuff
|
|
|
|
git checkout -b "Version-$VERSION"
|
|
|
|
git add --all
|
|
|
|
git commit -m "Empire $VERSION Release"
|
|
|
|
# NO NEED TO TAG IF WE RELEASE
|
|
|
|
# git tag -a "$VERSION" -m "Empire $VERSION Release"
|
|
|
|
git push origin "Version-$VERSION"
|
|
|
|
# git push origin "dev" --tags
|
|
|
|
git checkout master
|
|
|
|
git merge "Version-$VERSION"
|
|
|
|
git push
|
|
|
|
hub release create $VERSION -m "Empire $VERSION Release"
|
|
|
|
fi
|
2017-12-21 22:11:51 +00:00
|
|
|
|
2017-12-21 22:17:14 +00:00
|
|
|
|
2017-12-23 22:41:41 +00:00
|
|
|
read -p "[!] Do you want to BUILD Docker image? [Y/N] " -n 1 -r
|
|
|
|
echo # (optional) move to a new line
|
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
|
|
|
then
|
|
|
|
# do dangerous stuff
|
|
|
|
# ALERT VERSION
|
|
|
|
echo "[*] Building Version: $VERSION"
|
|
|
|
# START BUILD
|
|
|
|
./.build.sh
|
|
|
|
fi
|
2017-12-21 22:17:14 +00:00
|
|
|
|
2017-12-03 22:11:43 +00:00
|
|
|
# DOCKER TAG/VERSIONING
|
|
|
|
docker tag $USERNAME/$IMAGE:latest $USERNAME/$IMAGE:$VERSION
|
|
|
|
|
2017-12-23 22:41:41 +00:00
|
|
|
read -p "[!] Do you want to PUSH to Docker Hub? [Y/N] " -n 1 -r
|
|
|
|
echo # (optional) move to a new line
|
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
|
|
|
then
|
|
|
|
# do dangerous stuff
|
|
|
|
# PUSH TO DOCKER HUB
|
|
|
|
docker push $USERNAME/$IMAGE:latest
|
|
|
|
echo "Docker image pushed: $USERNAME/$IMAGE:latest"
|
|
|
|
docker push $USERNAME/$IMAGE:$VERSION
|
|
|
|
echo "Docker image pushed: $USERNAME/$IMAGE:$VERSION"
|
|
|
|
fi
|