-
Notifications
You must be signed in to change notification settings - Fork 4
/
build-docs.sh
executable file
·69 lines (61 loc) · 1.22 KB
/
build-docs.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
#! /bin/bash
thisDir=${PWD}
tmpPath="tmp"
docsPath="docs"
gitRepo="https://github.com/hyperledger/aries-cloudagent-python.git"
help() {
# Display help text
cat <<-EOF
Usage: $0 [OPTIONS]
Options:
-t Git tag to checkout. Default branch is main
-k Keep the tmp folder
-h Help
EOF
exit 1
}
if [ $# -eq 0 ]; then
help
exit
fi
gitTag=main
delTmp=true
while getopts "hkt:" option; do
case $option in
h) # display Help
help
exit
;;
t) # Enter a Git tag to checkout
gitTag=$OPTARG ;;
k) # Keep the tmp folder
delTmp=false ;;
\?) # Invalid option
echo "Error: Invalid option"
exit
;;
esac
done
# If there is no tmp dire must be made
if [ -f $tmpPath ]; then
delTmp=true
fi
# Make the tmp folder if necessary
if [ "$delTmp" == "true" ]; then
cd ${thisDir}
rm -rf $tmpPath
git clone $gitRepo $tmpPath
cd $tmpPath
if [ "$gitTag" != "main" ]; then
git fetch --all --tags
git checkout tags/$gitTag -b $gitTag
fi
else
echo Checking the ACA-Py version
cd $tmpPath
git status
fi
# In the root folder
cd ${thisDir}
echo "Running copy script"
./scripts/copyFixMDs.sh ${gitTag}