-
Notifications
You must be signed in to change notification settings - Fork 3
/
update-and-deploy.sh
executable file
·74 lines (60 loc) · 1.3 KB
/
update-and-deploy.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
#!/bin/bash
set -e
home=$(pwd)
sep='---------------------------------'
# Activate the virtual environment
source .venv/bin/activate
stop() {
echo >&2 "$@"
exit 0
}
usage() {
echo "usage: <command> dsp=[main version] api=[api version] app=[app version] tools=[tools version] ingest=[ingest version] meta=[meta version] deploy=[false]"
echo ${sep}
}
v=""
api=""
app=""
tools=""
ingest=""
meta=""
deploy=false
for ARGUMENT in "$@"; do
KEY=$(echo $ARGUMENT | cut -f1 -d=)
KEY_LENGTH=${#KEY}
VALUE="${ARGUMENT:$KEY_LENGTH+1}"
if [[ $KEY == "dsp" ]]; then
echo "Prepare new release ${VALUE}"
v=$VALUE
echo $sep
echo $sep
elif [[ $KEY == "deploy" ]]; then
deploy=$VALUE
else
echo "Update submodule dsp-${KEY} ${VALUE}"
cd dsp/dsp-${KEY}
echo $(pwd)
git fetch
git checkout ${VALUE}
cd "${home}"
git add dsp/dsp-${KEY}
echo $sep
fi
done
# set alias: default is latest, rc is prerelease
alias="latest"
if [[ $v == *"-rc"* ]]; then
echo "This version is a release candidate"
alias="prerelease"
fi
if [ "${deploy}" = false ]; then
stop "do not deploy"
else
# generates images from dot files
make graphvizfigures
# update openapi
make openapi-update
echo "Deploy version ${v} to github pages now"
mike deploy --push --branch gh-pages --update-aliases "${v}" "${alias}"
echo $sep
fi