-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·79 lines (67 loc) · 2.54 KB
/
build.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
#!/bin/bash
GH_TOKEN=$1
DIR_BASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DIR_ENV=$DIR_BASE/venv
DIR_MODULES=$DIR_BASE/modules
DIR_RELEASE="${DIR_BASE}/src/releases/"
URL_RELEASE_TAG='https://api.github.com/repos/oasislmf/OasisPlatform/releases/tags/<TAG>'
URL_RELEASE_LATEST='https://api.github.com/repos/oasislmf/OasisPlatform/releases/latest'
set -e
## SETUP BUILD ENVIROMENT
git_modules=(
#'OasisLMF'
#'OasisPlatform'
#'Ktools'
)
for module in "${git_modules[@]}"; do
cd $DIR_MODULES
if [ ! -d $module ]; then
printf "\n== Download %s ==\n" "${module}"
git clone "https://github.com/OasisLMF/${module}.git"
else
printf "\n== Update %s ==\n" "${module}"
cd $module
git pull
fi
done
# Create Python virtualenv
cd $DIR_BASE
if [ ! -f ${DIR_ENV}/bin/activate ]; then
printf "\n == Create Python virtualenv =="
virtualenv -p python3 $DIR_ENV
fi
source ${DIR_ENV}/bin/activate
# Update python env
pip install -r requirements.txt
###pip install -r $DIR_BASE/modules/OasisPlatform/requirements.in
# Script to extract / prase RELEASE.md / CHANGELOG.md notes
#sed -n '/start_latest_release/,/end_latest_release/p;/end_latest_release/q' $DIR_MODULES/Ktools/CHANGELOG.rst | sed '1d;$d' > $DIR_RELEASE/ktools.md
#sed -n '/start_latest_release/,/end_latest_release/p;/end_latest_release/q' $DIR_MODULES/OasisLMF/CHANGELOG.rst | sed '1d;$d' > $DIR_RELEASE/oasislmf.md
#sed -n '/start_latest_release/,/end_latest_release/p;/end_latest_release/q' $DIR_MODULES/OasisPlatform/CHANGELOG.rst | sed '1d;$d' > $DIR_RELEASE/oasis_platform.md
# Get the latest release notes
#if ! [ -x "$(command -v jq)" ]; then
# echo 'Error: jq is not installed.' >&2
#else
# #cd $DIR_MODULES/OasisPlatform
# #curl -s $URL_RELEASE_LATEST | jq -r '{body} | .body' > latest_release.md
#fi
# Get Known issues
#if [ ! -z "$GH_TOKEN" ]; then
# cd $DIR_BASE
# ./known_issues.py $GH_TOKEN > $DIR_MODULES/OasisPlatform/known_issues.md
# echo 'Witten known_issues list'
#else
# echo 'Missing GitHub token'
# exit 1
#fi
# Update JSON specs
./update-redoc.py
# Build docs
cd $DIR_BASE
make html SPHINXBUILD="python ${DIR_ENV}/bin/sphinx-build"
# Create TAR
if [[ ! -d "$DIR_BASE/output/" ]]; then
mkdir $DIR_BASE/output/
fi
tar -czvf oasis_docs.tar.gz -C build/html/ .
mv oasis_docs.tar.gz $DIR_BASE/output/