forked from BC-SECURITY/Empire
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.release.sh
executable file
·68 lines (61 loc) · 1.84 KB
/
.release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
set -ex
# Requires the following packages: git, hub, docker
# SET THE FOLLOWING VARIABLES
USERNAME=empireproject
IMAGE=empire
VERSION="$(cat VERSION)"
# UPDATE THE SOURCE CODE
git pull
# bump version
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
VERSION=`cat VERSION`
echo "[*] Current version: $VERSION"
# TAF, PULL, MERGE DEV
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
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
# DOCKER TAG/VERSIONING
docker tag $USERNAME/$IMAGE:latest $USERNAME/$IMAGE:$VERSION
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