53 lines
2 KiB
YAML
53 lines
2 KiB
YAML
include: /gitlab-templates/blocks/workflow.yml
|
|
|
|
variables:
|
|
WEBSITE_LANGUAGES: en # space seperated list of languages to build
|
|
DOC_ROOT: "." # path to the directory containing documentation in the repo
|
|
|
|
build_sphinx_app_docs:
|
|
image: storage.kde.org/vm-images/staticweb
|
|
tags:
|
|
- VM
|
|
- amd64
|
|
stage: build
|
|
variables:
|
|
GIT_DEPTH: "3"
|
|
before_script:
|
|
- git clone https://invent.kde.org/sysadmin/ci-utilities.git
|
|
- git clone https://invent.kde.org/sysadmin/ci-notary-service.git
|
|
script:
|
|
- git config --global --add safe.directory $CI_PROJECT_DIR
|
|
- |
|
|
langList=$WEBSITE_LANGUAGES
|
|
if [ $CI_COMMIT_REF_PROTECTED != "true" ]; then
|
|
langList=en
|
|
fi
|
|
- |
|
|
for langToBuild in $langList; do
|
|
# build html
|
|
sphinx-build -M html "$DOC_ROOT" _staging/$langToBuild -D language="$langToBuild" -w _logs/warnings-$langToBuild-html.log -j auto
|
|
mkdir -p public/$langToBuild/
|
|
mv _staging/$langToBuild/html/* public/$langToBuild/
|
|
# build epub
|
|
sphinx-build -M epub "$DOC_ROOT" _staging/$langToBuild -D language="$langToBuild" -w _logs/warnings-$langToBuild-epub.log -j auto
|
|
mkdir public/$langToBuild/epub/
|
|
mv _staging/$langToBuild/epub/*.epub public/$langToBuild/epub/
|
|
done
|
|
# turn duplicated files like image for each language into symlinks to reduce file size
|
|
- rdfind -makesymlinks true -makeresultsfile true $CI_PROJECT_DIR/public/
|
|
- mv results.txt _logs/rdfind-log.txt
|
|
# make symlinks relative (rdfind creates absolute symlinks)
|
|
- symlinks -cr $CI_PROJECT_DIR/public/ | tee _logs/symlinks-log.txt
|
|
# Publish
|
|
- python3 -u ci-notary-service/publishwebsite.py --config ci-utilities/signing/publishwebsite.ini public/
|
|
# Cleanup ebup files for artifacts capturing as they are too big
|
|
- rm -f public/*/epub/*.epub
|
|
artifacts:
|
|
expire_in: 1 week
|
|
when: always
|
|
paths:
|
|
- _logs/
|
|
- public/
|
|
- task*.log
|
|
exclude:
|
|
- public/**/*.epub # Do not capture the epubs, they are too big in most cases
|