forked from GoogleCloudPlatform/cloud-opensource-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcancel_release.sh
More file actions
executable file
·44 lines (32 loc) · 789 Bytes
/
cancel_release.sh
File metadata and controls
executable file
·44 lines (32 loc) · 789 Bytes
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
#!/bin/bash -
# Usage: ./cancel_release.sh <release version>
set -e
EchoRed() {
echo "$(tput setaf 1; tput bold)$1$(tput sgr0)"
}
EchoGreen() {
echo "$(tput setaf 2; tput bold)$1$(tput sgr0)"
}
Die() {
EchoRed "$1"
exit 1
}
DieUsage() {
Die "Usage: ./cancel_release.sh <release version>]"
}
# Usage: CheckVersion <version>
CheckVersion() {
[[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z]+)?$ ]] || Die "Version: $1 not in ###.###.###[-XXX] format."
}
[ $# -ne 1 ] && DieUsage
EchoGreen 'Cancelling release...'
VERSION=$1
CheckVersion ${VERSION}
if [[ $(git status -uno --porcelain) ]]; then
Die 'There are uncommitted changes.'
fi
git checkout master
git branch -D ${VERSION}-bom
git fetch --tags --force
git tag -d v${VERSION}-bom
git push origin :v${VERSION}-bom