Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
./scripts/ci_deploy_gh_pages.sh ${{ github.workspace }}/build $sha ${{ secrets.GITHUB_TOKEN }}
22 changes: 13 additions & 9 deletions scripts/ci_deploy_gh_pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
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