manual_teachbooks/.gitlab-ci.yml
Caspar Jungbacker aa01e9634d Update .gitlab-ci.yml
- Exclude venv/ from rsync
- Clean up cache
2023-04-18 11:48:46 +02:00

48 lines
1.1 KiB
YAML

image: python:3.10-bullseye
stages:
- build
- deploy
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
- venv/
before_script:
- python -V
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
build-book:
stage: build
only:
- main
script:
- pip install -r requirements.txt
- jupyter-book clean book/
- jupyter-book build book/
artifacts:
paths:
- book/_build/html/
push-html:
stage: deploy
only:
- main
before_script:
- apt-get update -y
- apt-get install rsync -y
- git config --global user.name "$GITLAB_USER_NAME"
- git config --global user.email "$GITLAB_USER_EMAIL"
- git fetch origin publish-html
- git checkout publish-html
script:
- rsync -av --delete-after --exclude=".git/" --exclude=".cache/" --exclude="venv/" ./book/_build/html/ .
- git add --all -- ':!.cache/*'
- git commit --allow-empty -m "$CI_COMMIT_MESSAGE"
- git push https://gitlab-ci-token:$ACCESS_TOKEN@gitlab.tudelft.nl/$CI_PROJECT_PATH.git publish-html