From 8e248513d2b473e527e0e5717f5357bf81507263 Mon Sep 17 00:00:00 2001 From: sethg Date: Sun, 22 Sep 2024 15:58:47 +0200 Subject: [PATCH 1/2] Clean repository when all languages are rebuilt --- .github/workflows/build.yml | 4 ++-- scripts/ci_deploy_website.sh | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8504559be..d95c838331 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,9 +28,9 @@ jobs: mkdir -p ~/.ssh echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa - echo -e "Host *\n\tStrictHostKeyChecking no\n" > ~/.ssh/config + echo -e "Host *\n\tStrictHostKeyChecking no\n" > ~/.ssh/config - touch ./build/html/.nojekyll + touch ./build/html/.nojekyll # get the short commit tag sha=$(git rev-parse --short ${{ github.sha }}) diff --git a/scripts/ci_deploy_website.sh b/scripts/ci_deploy_website.sh index f8be4b5b60..eb393b79b4 100755 --- a/scripts/ci_deploy_website.sh +++ b/scripts/ci_deploy_website.sh @@ -4,27 +4,37 @@ builddir=$1 destdir=$2 sha=$3 +# check the PDF was created and upload to https://mapserver.org/pdf/MapServer.pdf if [ -f $builddir/latex/en/MapServer.pdf ]; then set -x scp $builddir/latex/en/MapServer.pdf mapserver@mapserver.org:/var/www/mapserver.org/pdf/ set +x fi - if [ ! -d $destdir/mapserver.github.io ]; then git clone git@github.com:mapserver/mapserver.github.io.git $destdir/mapserver.github.io fi +# remove all previous files in the repo if [build_translations] +# is in the commit message +git log -n1 | grep -q "\\[build_translations\\]" + +if [[ $? -eq 0 ]]; then + rm -rf "$destdir/mapserver.github.io"/* +fi + +# copy in the newly created files cd $builddir/html cp -rf * $destdir/mapserver.github.io cd $destdir/mapserver.github.io + +# restore README.md from the last commit +git checkout HEAD -- README.md + git config user.email "mapserverbot@mapserver.bot" git config user.name "MapServer deploybot" -#rm -rf _sources */_sources -#rm -rf .doctrees */.doctrees */.buildinfo - git add -A git commit -m "update with results of commit https://github.com/mapserver/MapServer-documentation/commit/$sha" git push origin master From 577850b1bd0040bcd0af91604326ab85b14c95ab Mon Sep 17 00:00:00 2001 From: sethg Date: Sun, 22 Sep 2024 17:28:42 +0200 Subject: [PATCH 2/2] Restore .nojekyll --- scripts/ci_deploy_website.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci_deploy_website.sh b/scripts/ci_deploy_website.sh index eb393b79b4..31201b771d 100755 --- a/scripts/ci_deploy_website.sh +++ b/scripts/ci_deploy_website.sh @@ -29,8 +29,9 @@ cp -rf * $destdir/mapserver.github.io cd $destdir/mapserver.github.io -# restore README.md from the last commit +# restore README.md and .nojekyll from the last commit git checkout HEAD -- README.md +git checkout HEAD -- .nojekyll git config user.email "mapserverbot@mapserver.bot" git config user.name "MapServer deploybot"