image: continuumio/miniconda:latest stages: - test - build - deploy variables: PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" REGISTRY_HOST: localhost:5000 TAG_LATEST: $REGISTRY_HOST/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME:latest TAG_COMMIT: $REGISTRY_HOST/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA cache: paths: - .cache/pip # This job tests if the book compiles gracefully after a new addition test-build: stage: test rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push" before_script: - python -V - conda env create -f environment.yml - conda init bash - source ~/.bashrc - conda activate jupyter-book-env script: - jupyter-book clean book/ - jupyter-book build book/ build-book: stage: build rules: - if: $CI_COMMIT_BRANCH == "publish" && $CI_PIPELINE_SOURCE == "push" before_script: - python -V - conda env create -f environment.yml - conda init bash - source ~/.bashrc - conda activate jupyter-book-env script: - jupyter-book clean book/ - jupyter-book build book/ artifacts: expire_in: 30 days paths: - book/_build/html/ build-container: image: docker stage: build rules: - if: $CI_COMMIT_BRANCH == "publish" && $CI_PIPELINE_SOURCE == "push" needs: - build-book before_script: - docker info script: - docker build -t $TAG_COMMIT -t $TAG_LATEST . - docker push $TAG_COMMIT - docker push $TAG_LATEST update-website: image: docker stage: deploy rules: - if: $CI_COMMIT_BRANCH == "publish" && $CI_PIPELINE_SOURCE == "push" script: - docker compose -f /etc/web_server/docker-compose.yml pull $CI_PROJECT_NAME - docker compose -f /etc/web_server/docker-compose.yml up -d environment: name: production url: https://interactivetextbooks.citg.tudelft.nl/