Add docs static html pushing in gitlab ci

parent 1f6da51f
......@@ -67,7 +67,8 @@ python37-django21:
- mkdir -p ~/.ssh
- echo "$IVO_KNOWN_HOST" > ~/.ssh/known_hosts
- echo "$COVERAGE_DEPLOY_SSH_KEY" > ~/.ssh/id_coverage
- chmod 0600 ~/.ssh/id_coverage
- echo "$DOCS_DEPLOY_SSH_KEY" > ~/.ssh/id_docs
- chmod 0600 ~/.ssh/id_*
- apt-get update
- apt-get install -y openssh-client
......@@ -77,7 +78,7 @@ coverage deploy:
dependencies:
- python37-django21
environment:
name: review/${CI_COMMIT_REF_NAME}
name: coverage/${CI_COMMIT_REF_NAME}
url: https://coverage.technicie.nl/${CI_COMMIT_REF_SLUG}/
on_stop: coverage remove
<<: *sshsetup
......@@ -94,7 +95,7 @@ coverage remove:
when: manual
image: debian:stretch
environment:
name: review/${CI_COMMIT_REF_NAME}
name: coverage/${CI_COMMIT_REF_NAME}
action: stop
variables:
GIT_STRATEGY: none
......@@ -106,7 +107,7 @@ coverage remove:
rmdir ${CI_COMMIT_REF_SLUG}
EOF
docs:
docs tests:
stage: test
image: $PY36_IMAGE
before_script:
......@@ -120,6 +121,59 @@ docs:
- echo "Checking if there are changes"
- poetry run ./generate-apidocs.sh
- git diff --exit-code
artifacts:
paths:
- docs/_build
docs deploy:
stage: deploy
image: debian:stretch
dependencies:
- docs tests
environment:
name: docs/${CI_COMMIT_REF_NAME}
url: https://docs.technicie.nl/${CI_COMMIT_REF_SLUG}/
on_stop: docs remove
<<: *sshsetup
script:
- |
sftp -i ~/.ssh/id_docs docswww@ivo.thalia.nu -b <<EOF
-rm ${CI_COMMIT_REF_SLUG}/*/*
-rm ${CI_COMMIT_REF_SLUG}/*
-rmdir ${CI_COMMIT_REF_SLUG}/_images
-rmdir ${CI_COMMIT_REF_SLUG}/_modules
-rmdir ${CI_COMMIT_REF_SLUG}/_sources
-rmdir ${CI_COMMIT_REF_SLUG}/_static
-rmdir ${CI_COMMIT_REF_SLUG}/doctest
-rmdir ${CI_COMMIT_REF_SLUG}/doctrees
-rmdir ${CI_COMMIT_REF_SLUG}
-mkdir ${CI_COMMIT_REF_SLUG}
put -r docs/_build/* ${CI_COMMIT_REF_SLUG}
EOF
docs remove:
stage: deploy
when: manual
image: debian:stretch
environment:
name: docs/${CI_COMMIT_REF_NAME}
action: stop
variables:
GIT_STRATEGY: none
<<: *sshsetup
script:
- |
sftp -i ~/.ssh/id_docs docswww@ivo.thalia.nu -b <<EOF
rm ${CI_COMMIT_REF_SLUG}/*/*
rm ${CI_COMMIT_REF_SLUG}/*
rmdir ${CI_COMMIT_REF_SLUG}/_images
rmdir ${CI_COMMIT_REF_SLUG}/_modules
rmdir ${CI_COMMIT_REF_SLUG}/_sources
rmdir ${CI_COMMIT_REF_SLUG}/_static
rmdir ${CI_COMMIT_REF_SLUG}/doctest
rmdir ${CI_COMMIT_REF_SLUG}/doctrees
rmdir ${CI_COMMIT_REF_SLUG}
EOF
build docker image:
stage: test
......
......@@ -23,11 +23,9 @@ ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
RUN mkdir /concrexit && \
mkdir -p /concrexit/log/ && \
touch /concrexit/log/uwsgi.log && \
mkdir -p /concrexit/docs/ && \
chown -R www-data:www-data /concrexit && \
mkdir -p /usr/src/app && \
mkdir -p /usr/src/app/website && \
mkdir -p /usr/src/app/docs
mkdir -p /usr/src/app/website
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
......@@ -44,10 +42,10 @@ WORKDIR /usr/src/app/website/
COPY pyproject.toml /usr/src/app/website/
COPY poetry.lock /usr/src/app/website/
RUN if [ "$install_dev_requirements" -eq 1 ]; then \
poetry install --no-interaction --extras "docs"; \
poetry install --no-interaction; \
else \
echo "This will fail if the dependencies are out of date"; \
poetry install --no-interaction --extras "docs" --no-dev; \
poetry install --no-interaction --no-dev; \
fi; \
poetry cache:clear --all --no-interaction pypi
......@@ -60,14 +58,4 @@ RUN chmod +x /usr/local/bin/entrypoint.sh && \
# copy app source
COPY website /usr/src/app/website/
# Copy files for Sphinx documentation
COPY README.md /usr/src/app/
COPY docs /usr/src/app/docs
RUN sphinx-build -c /usr/src/app/docs/ /usr/src/app/docs/ /usr/src/app/docs/_build && \
tar --create --xz --file=/usr/src/app/docs.tar.xz --directory=/usr/src/app/docs/_build/ . && \
rm --recursive /usr/src/app/docs/
# Cache docs between builds if not mounting to FS
VOLUME /concrexit/docs
RUN echo "Don't build releases yourself, let CI do it!"
......@@ -2,7 +2,6 @@
set -e
tar --extract --xz --file=/usr/src/app/docs.tar.xz --directory=/concrexit/docs/
chown -R www-data:www-data /concrexit/
until psql -h "$DJANGO_POSTGRES_HOST" -U "postgres" -c '\l' "$POSTGRES_DB"; do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment