Add docusaurus and swagger.
continuous-integration/drone/push Build is passing Details

master
Thomas BELLEMBOIS 2 years ago
parent 496f001509
commit 56b36cf774

@ -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/

@ -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/
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 "<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Refresh" content=\"0; url=/swagger?url=/documentation/$DRONE_REPO_OWNER/swagger/$DRONE_REPO_NAME/$swaggerfile\" />
</head>
<body>
<p>Suivez <a href=\"/swagger?url=/swagger?url=/documentation/$DRONE_REPO_OWNER/swagger/$DRONE_REPO_NAME/$swaggerfile\">ce lien</a>.</p>
</body>
</html>" > /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/

Loading…
Cancel
Save