#!/usr/bin/env bash echo "Repository name: "$DRONE_REPO_NAME echo "Repository owner: "$DRONE_REPO_OWNER 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/