-
Notifications
You must be signed in to change notification settings - Fork 9
/
generate-release.sh
executable file
·99 lines (80 loc) · 1.93 KB
/
generate-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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env bash
## Usage: ./generate-release.sh 1.0.0 [default-branch]
VERSION=$1
if [[ "${VERSION}x" == "x" ]]
then
echo Missing version parameter!
echo Usage:
echo ./generate-release.sh 1.0.0
exit 1
fi
DEFAULT_BRANCH=master
if [[ "${2}x" != "x" ]]
then
DEFAULT_BRANCH=$2
echo Updated default branch to $2
fi
# Ensure script directory is CWD
cd "${0%/*}"
tput setaf 2
echo "Building release $VERSION"
tput sgr0
if [[ $(git rev-parse --abbrev-ref HEAD) != "${DEFAULT_BRANCH}" ]]; then
tput setaf 1
echo "Current branch is not ${DEFAULT_BRANCH}!"
tput sgr0
git rev-parse --abbrev-ref HEAD
exit 1
fi
git diff-index --quiet HEAD
if [[ $? != 0 ]]; then
tput setaf 1
echo "Current index is not clean!"
tput sgr0
git diff-index HEAD
fi
tput setaf 2
echo -e "\nDetach the head"
tput sgr0
git checkout --detach
tput setaf 2
echo -e "\nChange the revision on the release, inject manifests and add version history"
tput sgr0
./set-version.sh $VERSION
./spec/examples/inject-manifests.sh
echo $VERSION >> .versions
tput setaf 2
echo -e "\nCommit the change"
tput sgr0
git commit -a -m "Update version values for release $VERSION"
tput setaf 2
echo -e "\nTag the release"
tput sgr0
git tag -a -m "Seed release $VERSION" $VERSION
tput setaf 2
echo -e "\nPush the changes"
tput sgr0
git push --tags
tput setaf 2
echo -e "\nSleeping 30 seconds so that tag is built prior to GitHub pages build"
tput sgr0
sleep 30
tput setaf 2
echo -e "\nCheckout back to ${DEFAULT_BRANCH}"
tput sgr0
git checkout ${DEFAULT_BRANCH}
tput setaf 2
echo -e "\nAdd $VERSION to version history"
tput sgr0
echo $VERSION >> .versions
tput setaf 2
echo -e "\nCommit the change"
tput sgr0
git commit -a -m "Add $VERSION to version history"
tput setaf 2
echo -e "\nPush the changes"
tput sgr0
git push
tput setaf 2
echo -e "\nDon't forget to update the release notes: https://github.com/ngageoint/seed/releases/edit/$VERSION"
tput sgr0