diff --git a/.docs/build-website.sh b/.docs/build-website.sh index 2cba2561f0de8ba63993405ccca26359d868a239..2cc64bc69ff062875f45dcafb1dddf0c57eb994b 100755 --- a/.docs/build-website.sh +++ b/.docs/build-website.sh @@ -1,6 +1,8 @@ #!/bin/bash INDEX_HTML="" +OVERRIDES_MAIN_HTML="" +SCRIPTS_EXTRA_JS="" function generate_docs { BRANCH="release-$1" @@ -14,6 +16,12 @@ function generate_docs { find .docs/ -type f -exec sed -i -e "s/__CHARTVERSION__/$1/g" {} \; if [ "$1" = "latest" ]; then INDEX_HTML=$(cat .docs/redirect.html) + OVERRIDES_MAIN_HTML=$(cat .docs/overrides/main.html) + SCRIPTS_EXTRA_JS=$(cat .docs/scripts/extra.js) + else + echo $OVERRIDES_MAIN_HTML > .docs/overrides/main.html + mkdir -p .docs/scripts + echo $SCRIPTS_EXTRA_JS > .docs/scripts/extra.js fi mkdocs build > /dev/null && cp -r ./site "./final/$1" cp -r "./swagger/$1" "./final/$1/swagger" @@ -43,11 +51,16 @@ if [ -z "$APP_VERSION" ]; then echo "Variable APP_VERSION not set" exit 2 fi +echo "===================================================" echo "APP_VERSION=$APP_VERSION" +echo "===================================================" # ensure branches exist on machine git fetch +generate_api "latest" +generate_docs "latest" + # versions for i in "${!versions[@]}"; do version="${versions[i]}" @@ -55,10 +68,11 @@ for i in "${!versions[@]}"; do generate_docs "$version" done + # finalization echo "===================================================" -echo "Adding index.html from branch master" +echo "Adding index.html from branch release-latest" echo $INDEX_HTML > .docs/redirect.html sed -i -e "s/__APPVERSION__/${APP_VERSION}/g" .docs/redirect.html cp ./.docs/redirect.html ./final/index.html -echo "===================================================" \ No newline at end of file +echo "===================================================" diff --git a/.docs/redirect.html b/.docs/redirect.html index 053a5581bfeeb797c2d571a1dd378b1ed88df305..a3737a67b6655b56c4c31f35f8bfc279a72b5e0f 100644 --- a/.docs/redirect.html +++ b/.docs/redirect.html @@ -5,7 +5,7 @@ <head> <meta charset="UTF-8"> <title>Redirect Notice</title> - <meta http-equiv="Refresh" content="0; url='https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/__APPVERSION__/'" /> + <meta http-equiv="Refresh" content="0; url='/infrastructures/dbrepo/__APPVERSION__/'" /> </head> <body> <h1>Redirect Notice</h1> @@ -14,7 +14,7 @@ available at: </p> <p> - <a href="https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/__APPVERSION__/">https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/__APPVERSION__/</a> + <a href="/infrastructures/dbrepo/__APPVERSION__/">/infrastructures/dbrepo/__APPVERSION__/</a> </p> </body> </html> \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index feb19e395926e34474fa068e8ebefbf3c7b6306b..a413165b11941212d67e9f57be78010be3c01b66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,11 +2,11 @@ FROM python:3.11-slim as build WORKDIR /app -ENV VERSIONS="latest,1.4.1,1.4.0" -ENV APP_VERSION="1.4.1" - RUN apt-get update && apt-get install -y git +ENV VERSIONS="1.4.1,1.4.0,1.3.0" +ENV APP_VERSION="1.4.1" + COPY .git/ .git/ COPY .docs/ .docs/ COPY ./requirements.txt ./requirements.txt @@ -18,9 +18,3 @@ FROM nginx as runtime WORKDIR /usr/share/nginx/html/infrastructures/dbrepo/ COPY --from=build /app/final /usr/share/nginx/html/infrastructures/dbrepo/ - -RUN rm -f ./index.html - -RUN pwd - -RUN ls -la \ No newline at end of file