Merge pull request #17 from TeachBooks/update-repo

Update repo
This commit is contained in:
Tom van Woudenberg 2024-11-16 14:49:14 +01:00 • committed by GitHub
commit 17795533a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 1 additions and 80 deletions

View file

@ -1,70 +0,0 @@
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_DRAFT: $REGISTRY_HOST/$CI_PROJECT_NAME-draft/$CI_COMMIT_REF_NAME:latest
GIT_SUBMODULE_STRATEGY: recursive # For submodules
cache:
paths:
- .cache/pip
# This job tests if the book compiles gracefully after a new addition
test-build:
stage: test
image: continuumio/miniconda3
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
script:
- pip install -r requirements.txt
- jupyter-book clean book/
- jupyter-book build book/
# This job builds the Docker container
build-book:
stage: build
image: docker
rules:
- if: $CI_COMMIT_BRANCH == "release" && $CI_PIPELINE_SOURCE == "push"
variables:
TAG: $TAG_LATEST
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"
variables:
TAG: $TAG_DRAFT
before_script:
- docker info
script:
- if [ "$TAG" = "$TAG_LATEST" ]; then sed --in-place=".bak" '/# START DRAFT/,/# END DRAFT/{//!d}' book/_config.yml; fi
- docker build -t $TAG .
- docker push $TAG
# This job takes down the existing container and starts the new one
deploy-book:
stage: deploy
image: docker
rules:
- if: $CI_COMMIT_BRANCH == "release" && $CI_PIPELINE_SOURCE == "push"
before_script:
- docker info
- docker stop $CI_PROJECT_NAME || exit_code=$?
- if [ $exit_code -ne 0 ]; then echo "Container not found, cannot stop"; else docker rm $CI_PROJECT_NAME; fi
script:
- docker run -d --restart always -p 8000:8000 --name $CI_PROJECT_NAME $TAG_LATEST # Make sure to use a different port for each book!
environment:
name: production
url: https://interactivetextbooks.citg.tudelft.nl/jupyter-book-manual
# Deploy the draft version of the book
deploy-draft:
stage: deploy
image: docker
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"
before_script:
- docker info
- docker stop $CI_PROJECT_NAME-draft || exit_code=$?
- if [ $exit_code -ne 0 ]; then echo "Container not found, cannot stop"; else docker rm $CI_PROJECT_NAME-draft; fi
script:
- docker run -d --restart always -p 8018:8000 --name $CI_PROJECT_NAME-draft $TAG_DRAFT
environment:
name: draft
url: https://interactivetextbooks.citg.tudelft.nl/jupyter-book-manual-draft

View file

@ -1,8 +0,0 @@
FROM continuumio/miniconda3
WORKDIR /book
COPY book/ .
RUN apt-get update && apt-get -y install git gcc
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
RUN jupyter book build .
ENTRYPOINT [ "python", "-m", "http.server", "8000", "--directory", "/book/_build/html" ]

View file

@ -29,7 +29,7 @@ sphinx:
use_thebe_lite: true
exclude_patterns: ["**/_*.yml", "**/*.md", "**/*.ipynb","**/*.gif","**/*.txt","**/*.json",]
html_theme_options:
repository_url: "https://gitlab.tudelft.nl/interactivetextbooks-citg/jupyter-book-manual"
repository_url: "https://github.com/TeachBooks/manual/"
use_repository_button: true
use_issues_button : true
launch_buttons:

View file

@ -1 +0,0 @@
dummy