Skip to content
Snippets Groups Projects
Verified Commit bf7e5594 authored by Martin Weise's avatar Martin Weise
Browse files

Updated the build script

parent 6a9e5839
Branches
Tags
No related merge requests found
#!/bin/bash #!/bin/bash
INDEX_HTML=""
function generate_docs { function generate_docs {
BRANCH="release-$1"
echo "===================================================" echo "==================================================="
echo "Building DOCS for version $1 on branch $2" echo "Building DOCS for version $1 on branch $BRANCH"
echo "===================================================" echo "==================================================="
git reset --hard && git checkout "$2" git reset --hard && git checkout "$BRANCH"
pip install -r ./requirements.txt > /dev/null pip install -r ./requirements.txt > /dev/null
mkdir -p ./final mkdir -p ./final
find .docs/ -type f -exec sed -i -e "s/__APPVERSION__/$1/g" {} \; find .docs/ -type f -exec sed -i -e "s/__APPVERSION__/$1/g" {} \;
find .docs/ -type f -exec sed -i -e "s/__CHARTVERSION__/$1/g" {} \; find .docs/ -type f -exec sed -i -e "s/__CHARTVERSION__/$1/g" {} \;
if [ "$1" = "latest" ]; then if [ "$1" = "latest" ]; then
INDEX_HTML=$(cat .docs/redirect.html) INDEX_HTML=$(cat .docs/redirect.html)
OVERRIDES_MAIN_HTML=$(cat .docs/overrides/main.html)
else
echo $OVERRIDES_MAIN_HTML > .docs/overrides/main.html
fi fi
mkdocs build > /dev/null && cp -r ./site "./final/$1" mkdocs build > /dev/null && cp -r ./site "./final/$1"
cp -r "./swagger/$1" "./final/$1/swagger" cp -r "./swagger/$1" "./final/$1/swagger"
} }
function generate_api { function generate_api {
BRANCH="release-$1"
echo "===================================================" echo "==================================================="
echo "Building API for version $1 on branch $2" echo "Building API for version $1 on branch $BRANCH"
echo "===================================================" echo "==================================================="
git reset --hard && git checkout "$2" git reset --hard && git checkout "$BRANCH"
bash .docs/.swagger/swagger-site.sh bash .docs/.swagger/swagger-site.sh
find ./site -type f -exec sed -i -e "s/__APPVERSION__/$1/g" {} \; find ./site -type f -exec sed -i -e "s/__APPVERSION__/$1/g" {} \;
mkdir -p "./swagger/$1" mkdir -p "./swagger/$1"
cp -r ./site/* "./swagger/$1/" cp -r ./site/* "./swagger/$1/"
} }
INDEX_HTML=""
OVERRIDES_MAIN_HTML=""
# usage # usage
if [ -z "$v1_TAGS" ]; then if [ -z "$VERSIONS" ]; then
echo "Variable v1_TAGS not set" echo "Variable VERSIONS not set"
exit 1 exit 1
fi fi
tags=(${v1_TAGS//,/ }) versions=(${VERSIONS//,/ })
# usage # usage
if [ -z "$APP_VERSION" ]; then if [ -z "$APP_VERSION" ]; then
...@@ -47,25 +45,14 @@ if [ -z "$APP_VERSION" ]; then ...@@ -47,25 +45,14 @@ if [ -z "$APP_VERSION" ]; then
fi fi
echo "APP_VERSION=$APP_VERSION" echo "APP_VERSION=$APP_VERSION"
echo " ~> latest"
for i in "${!tags[@]}"; do
version="${tags[i]}"
echo " ~> $version"
done
# ensure branches exist on machine # ensure branches exist on machine
git fetch git fetch
# latest
generate_api "latest" "master"
generate_docs "latest" "master"
# versions # versions
for i in "${!tags[@]}"; do for i in "${!versions[@]}"; do
version="${tags[i]}" version="${versions[i]}"
generate_api "$version" "v$version" generate_api "$version"
generate_docs "$version" "v$version" generate_docs "$version"
done done
# finalization # finalization
......
...@@ -2,7 +2,7 @@ FROM python:3.11-slim as build ...@@ -2,7 +2,7 @@ FROM python:3.11-slim as build
WORKDIR /app WORKDIR /app
ENV v1_TAGS="1.4.0,1.4.1" ENV VERSIONS="latest,1.4.1,1.4.0"
ENV APP_VERSION="1.4.1" ENV APP_VERSION="1.4.1"
RUN apt-get update && apt-get install -y git RUN apt-get update && apt-get install -y git
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment