From d504fad1f076d6a0b729e994dc417492eaccf10d Mon Sep 17 00:00:00 2001 From: sethg Date: Fri, 12 Jun 2026 23:57:56 +0200 Subject: [PATCH] Script updates --- .github/workflows/build.yml | 2 +- scripts/ci_deploy_gh_pages.sh | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38baa94f89a..2e37933cd7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,4 +46,4 @@ jobs: run: | sha=$(git rev-parse --short ${{ github.sha }}) echo "Publishing main branch (commit $sha) to gh-pages" - ./scripts/ci_deploy_gh_pages.sh build $sha ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + ./scripts/ci_deploy_gh_pages.sh ${{ github.workspace }}/build $sha ${{ secrets.GITHUB_TOKEN }} diff --git a/scripts/ci_deploy_gh_pages.sh b/scripts/ci_deploy_gh_pages.sh index e09d54da164..0c3c71c9cd7 100755 --- a/scripts/ci_deploy_gh_pages.sh +++ b/scripts/ci_deploy_gh_pages.sh @@ -3,27 +3,31 @@ # MapServer-documentation repo. Called from build.yml when a push to main # is detected +set -euo pipefail + builddir=$1 sha=$2 github_token=$3 -git config user.email "mapserverbot@mapserver.bot" -git config user.name "MapServer deploybot" +git config --global user.email "mapserverbot@mapserver.bot" +git config --global user.name "MapServer deploybot" -git clone --no-checkout --depth=1 \ - https://x-access-token:${github_token}@github.com/mapserver/MapServer-documentation.git \ +git clone --depth=1 \ + https://x-access-token:${github_token}@github.com/MapServer/MapServer-documentation.git \ /tmp/MapServer-documentation cd /tmp/MapServer-documentation -git checkout -B gh-pages +git fetch origin gh-pages +git checkout -B gh-pages origin/gh-pages # delete existing files -git rm -r * --quiet || true +git rm -rf --quiet --ignore-unmatch . + # add in the new build files -cp -rf "$builddir/html/"* . +cp -a "$builddir/html/." . touch .nojekyll git add -A -git commit -m "update with results of commit https://github.com/mapserver/MapServer-documentation/commit/$sha" --quiet || echo "Nothing to commit" -git push origin gh-pages --force \ No newline at end of file +git commit -m "update with results of commit https://github.com/MapServer/MapServer-documentation/commit/$sha" --quiet || echo "Nothing to commit" +git push origin gh-pages \ No newline at end of file