diff --git a/Dockerfile b/Dockerfile index 9434cca..cdb8599 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,10 @@ -FROM debian:bullseye +FROM debian:bookworm LABEL author="Thomas Bellembois" -RUN apt update && apt -y install sshpass rsync doxygen +RUN apt update && apt -y install sshpass rsync doxygen nodejs npm + +WORKDIR /usr/local +RUN npm install docusaurus RUN mkdir /root/.ssh COPY ./id_rsa /root/.ssh/ diff --git a/entrypoint.sh b/entrypoint.sh index a6d1480..42ff807 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,35 @@ #!/usr/bin/env bash -echo "repository name: "$DRONE_REPO_NAME -echo "repository owner: "$DRONE_REPO_OWNER +echo "Repository name: "$DRONE_REPO_NAME +echo "Repository owner: "$DRONE_REPO_OWNER -echo "Copying documentation for user $DRONE_REPO_OWNER and repository $DRONE_REPO_NAME" -rsync --rsync-path="mkdir -p /usr/share/nginx/html/$DRONE_REPO_OWNER/$DRONE_REPO_NAME/ && rsync" -e "ssh -o StrictHostKeyChecking=no" -avz /docs root@nginx:/usr/share/nginx/html/$DRONE_REPO_OWNER/$DRONE_REPO_NAME/ \ No newline at end of file +echo "Generating and deploying documentation for user $DRONE_REPO_OWNER and repository $DRONE_REPO_NAME" + +mkdir -p /docs/doxygen/ +mkdir -p /docs/docusaurus/ + +DOCDIR="Documentation" +[ -d "/drone/src/documentation" ] && DOCDIR="documentation" + +[ -d "/drone/src/$DOCDIR/doxygen" ] && cd /drone/src/$DOCDIR/doxygen && doxygen Doxyfile +[ -d "/drone/src/$DOCDIR/docusaurus" ] && cd /drone/src/$DOCDIR/docusaurus && npm install && npm run build + +swaggerfile=$(find /docs -maxdepth 1 -type f -iname "swagger.*" -printf "%f" -quit) +if [[ ! -z "$swaggerfile" ]] +then + echo " + +
+ + + +Suivez ce lien.
+ +" > /docs/CLICKME.html +fi + +cd /drone/src/$DOCDIR + +rsync --rsync-path="mkdir -p /usr/share/nginx/html/$DRONE_REPO_OWNER/doxygen/$DRONE_REPO_NAME/ && rsync" -e "ssh -o StrictHostKeyChecking=no" -avz --delete /docs/doxygen/ root@nginx:/usr/share/nginx/html/$DRONE_REPO_OWNER/doxygen/$DRONE_REPO_NAME/ +rsync --rsync-path="mkdir -p /usr/share/nginx/html/$DRONE_REPO_OWNER/swagger/$DRONE_REPO_NAME/ && rsync" -e "ssh -o StrictHostKeyChecking=no" -avz --delete /docs/{swagger.*,CLICKME.html} root@nginx:/usr/share/nginx/html/$DRONE_REPO_OWNER/swagger/$DRONE_REPO_NAME/ +rsync --rsync-path="mkdir -p /usr/share/nginx/html/$DRONE_REPO_OWNER/docusaurus/$DRONE_REPO_NAME/ && rsync" -e "ssh -o StrictHostKeyChecking=no" -avz --delete docusaurus/build/ root@nginx:/usr/share/nginx/html/$DRONE_REPO_OWNER/docusaurus/$DRONE_REPO_NAME/