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..31201b771d 100755 --- a/scripts/ci_deploy_website.sh +++ b/scripts/ci_deploy_website.sh @@ -4,27 +4,38 @@ 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 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" -#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