mirror of
https://github.com/TeachBooks/manual.git
synced 2026-11-13 23:05:51 +00:00
73 lines
No EOL
1.7 KiB
YAML
73 lines
No EOL
1.7 KiB
YAML
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
|
|
|
|
# Before running other jobs, setup the Anaconda environment
|
|
before_script:
|
|
- python -V
|
|
- conda env create -f environment.yml
|
|
- conda init bash
|
|
- source ~/.bashrc
|
|
- conda activate jupyter-book-env
|
|
|
|
# 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"
|
|
script:
|
|
- pip install -r requirements.txt
|
|
- jupyter-book clean book/
|
|
- jupyter-book build book/
|
|
|
|
build-book:
|
|
stage: build
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == "publish" && $CI_PIPELINE_SOURCE == "push"
|
|
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 pull $CI_PROJECT_NAME
|
|
- docker-compose up -d
|
|
environment:
|
|
name: production
|
|
url: https://interactivetextbooks.citg.tudelft.nl/ |