Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,3 @@ dj_local_conf_old.json
**/*~
**/#*#
**/.#*
docker-compose.y*ml
51 changes: 51 additions & 0 deletions docs/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# MODE="LIVE|QA|PUSH" PACKAGE=element_interface UPSTREAM_REPO=https://github.com/datajoint/element-interface.git HOST_UID=$(id -u) docker compose -f docs/docker-compose.yaml up --build
#
# navigate to http://localhost/
version: "2.4"
services:
docs:
build:
dockerfile: docs/.docker/Dockerfile
context: ../
args:
- PACKAGE
image: ${PACKAGE}-docs
environment:
- PACKAGE
- UPSTREAM_REPO
- MODE
- GOOGLE_ANALYTICS_KEY
- PATCH_VERSION
volumes:
- ../docs:/main/docs
- ../${PACKAGE}:/main/${PACKAGE}
user: ${HOST_UID}:anaconda
ports:
- 80:80
command:
- sh
- -c
- |
git config --global --add safe.directory /main
set -e
export PATCH_VERSION=$$(cat /main/$${PACKAGE}/version.py | grep -oE '\d+\.\d+\.[a-z0-9]+')
if echo "$${MODE}" | grep -i live &>/dev/null; then
mkdocs serve --config-file ./docs/mkdocs.yaml -a 0.0.0.0:80
elif echo "$${MODE}" | grep -iE "qa|push" &>/dev/null; then
echo "INFO::Delete gh-pages branch"
git branch -D gh-pages || true
echo "INFO::Fetch upstream gh-pages"
git fetch $${UPSTREAM_REPO} gh-pages:gh-pages && git switch gh-pages || git switch --orphan gh-pages && git commit --allow-empty -m "init commit"
echo "INFO::mike"
mike deploy --config-file ./docs/mkdocs.yaml -u $$(grep -oE '\d+\.\d+' /main/$${PACKAGE}/version.py) latest
mike set-default --config-file ./docs/mkdocs.yaml latest
if echo "$${MODE}" | grep -i qa &>/dev/null; then
mike serve --config-file ./docs/mkdocs.yaml -a 0.0.0.0:80
elif echo "$${MODE}" | grep -i push &>/dev/null; then
echo "INFO::Push gh-pages to upstream"
git push $${UPSTREAM_REPO} gh-pages
fi
else
echo "Unexpected mode..."
exit 1
fi