mirror of
https://github.com/TeachBooks/manual.git
synced 2026-11-13 06:45:52 +00:00
- Update the `rsync` command so that it deletes files that are not included in the build anymore - Allow for empty commits
49 lines
1.1 KiB
YAML
49 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/
|
|
- archive/_build
|
|
|
|
before_script:
|
|
- python -V
|
|
- pip install virtualenv
|
|
- virtualenv venv
|
|
- source venv/bin/activate
|
|
|
|
jupyter-build:
|
|
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/" ./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
|