forked from GoogleCloudPlatform/cloud-opensource-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_docs.sh
More file actions
48 lines (34 loc) · 1.27 KB
/
update_docs.sh
File metadata and controls
48 lines (34 loc) · 1.27 KB
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
#!/bin/bash -
# Usage: ./update_docs.sh <old version> <new 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: ./release.sh <dependencies|bom|lts> <release version> [<post-release-version>]"
}
# Usage: CheckVersion <version>
CheckVersion() {
[[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z]+)?$ ]] || Die "Version: $1 not in ###.###.###[-XXX] format."
}
gcertstatus --quiet --check_ssh=false --check_remaining=10m \
|| Die "Run gcert."
OLDVERSION=$1
CheckVersion ${OLDVERSION}
NEWVERSION=$2
CheckVersion ${NEWVERSION}
# CITC client names can't contain periods
citcclient="bom-docs-${NEWVERSION//\./_}"
p4 g4d -f ${citcclient}
clientdir="$(p4 g4d -- "${citcclient?}")"
cd "${clientdir}"
/google/src/head/depot/google3/devtools/scripts/replace_string "<version>${OLDVERSION}</version>" "<version>${NEWVERSION}</version>"
/google/src/head/depot/google3/devtools/scripts/replace_string "<version>${OLDVERSION}</version>" "<version>${NEWVERSION}</version>"
/google/src/head/depot/google3/devtools/scripts/replace_string "<version>${OLDVERSION}</version>" "<version>${NEWVERSION}</version>"