Skip to content
Snippets Groups Projects
Commit dae68d79 authored by Robert Lanzafame's avatar Robert Lanzafame
Browse files

Merge branch 'main' into 'publish'

test publish build

See merge request !367
parents 8f944f57 7df49da6
No related branches found
No related tags found
2 merge requests!394Week 8 adjustments from Robert,!367test publish build
Pipeline #245628 passed
image: python:3.10-bullseye
stages:
- test
- build
- deploy
......@@ -13,39 +12,65 @@ cache:
- .cache/pip
- venv/
# Before running other jobs, setup Python
before_script:
- python -V
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip install -r requirements.txt
# This job tests if the book compiles gracefully after a new addition
test-build:
stage: test
build-book:
stage: build
script:
- |
if [ "$CI_COMMIT_BRANCH" == "publish" ]; then
echo "Building production version"
teachbooks build --publish book/ > >(tee stdout.log) 2> >(tee stderr.log >&2)
else
echo "Building draft version"
teachbooks build book/ > >(tee stdout.log) 2> >(tee stderr.log >&2)
fi
- echo $CI_JOB_ID > build_job_id.txt
artifacts:
paths:
- book/_build/html
- stdout.log
- stderr.log
- build_job_id.txt
expire_in: 1 week
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"
- if: $CI_COMMIT_BRANCH == "publish" && $CI_PIPELINE_SOURCE == "push"
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "publish"
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish"
when: always
deploy-draft:
stage: deploy
needs: ["build-book"]
script:
- pip install -r requirements.txt
- jupyter-book clean book/
- jupyter-book build book/
- BUILD_JOB_ID=$(cat build_job_id.txt)
- |
curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-draft \
-H "Content-Type: application/json" \
-H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \
-d "{\"object_kind\":\"pipeline\",\"object_attributes\":{\"status\":\"success\",\"ref\":\"main\"},\"build_job_id\":$BUILD_JOB_ID}"
environment:
name: draft
url: https://mude.citg.tudelft.nl/2024/book/draft
rules:
- if: $CI_COMMIT_BRANCH == "main"
# This job commits the built HTML to the publish-html branch
# push-html:
# stage: deploy
# only:
# - publish
# 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
deploy-production:
stage: deploy
needs: ["build-book"]
script:
- BUILD_JOB_ID=$(cat build_job_id.txt)
- |
curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-production \
-H "Content-Type: application/json" \
-H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \
-d "{\"object_kind\":\"pipeline\",\"object_attributes\":{\"status\":\"success\",\"ref\":\"publish\"},\"build_job_id\":$BUILD_JOB_ID}"
environment:
name: production
url: https://mude.citg.tudelft.nl/2024/book
rules:
- if: $CI_COMMIT_BRANCH == "publish"
\ No newline at end of file
File added
......@@ -12,12 +12,18 @@ sphinx:
config:
# Bibliography style
bibtex_reference_style: author_year
html_js_files:
- https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js
patch_config:
disabled-patches: []
html_show_copyright: false
html_last_updated_fmt: '%B %-d, %Y'
html_js_files:
- https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js
thebe_config:
use_thebe_lite: true
exclude_patterns: ["**/_*.yml", "**/*.md", "**/*.ipynb"]
html_theme_options:
launch_buttons:
thebe: true
extra_extensions:
- sphinx_inline_tabs
- sphinx_grasple
......@@ -29,10 +35,8 @@ sphinx:
bibtex_bibfiles:
- _bibliography/references_pd.bib
launch_buttons:
thebe: true
html:
# announcement: "Content in this book will be released one week at a time, beginning Sep 3."
# announcement: "<p>This book is archived from the 2023-24 academic year. The most recent version is at <a href='https://mude.citg.tudelft.nl/book' style='color: cyan;'>mude.citg.tudelft.nl/book</a>; find out more at the <a href='https://mude.citg.tudelft.nl/archive' target='_blank' style='color: cyan;'>MUDE Archive</a>.</p>"
use_multitoc_numbering: false
# comments:
......
......@@ -9,7 +9,6 @@ For now, you can read the course description [here](https://www.studiegids.tudel
Material from last year is also available, but note that this should be used for general information only as **the material can change significantly!**
- Use these links to visit the [book](https://mude.citg.tudelft.nl/2023/) and [website](https://mude.citg.tudelft.nl/2023/book) from last year.
- For more information, visit the [MUDE Archive](https://mude.citg.tudelft.nl/archive/).
````
......
......@@ -9,3 +9,5 @@ docutils == 0.17.1
--extra-index-url https://gitlab.tudelft.nl/api/v4/projects/17983/packages/pypi/simple
jupyterbook_patches ~= 0.1.4
--extra-index-url https://gitlab.tudelft.nl/api/v4/projects/11239/packages/pypi/simple
sphinx-thebe ~= 0.9.9
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment