Skip to content

Commit 2200dd7

Browse files
authored
Script updates (#1089)
1 parent e5bedb8 commit 2200dd7

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ jobs:
4646
run: |
4747
sha=$(git rev-parse --short ${{ github.sha }})
4848
echo "Publishing main branch (commit $sha) to gh-pages"
49-
./scripts/ci_deploy_gh_pages.sh build $sha ${{ secrets.GITHUB_TOKEN }}
49+
./scripts/ci_deploy_gh_pages.sh ${{ github.workspace }}/build $sha ${{ secrets.GITHUB_TOKEN }}

scripts/ci_deploy_gh_pages.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,31 @@
33
# MapServer-documentation repo. Called from build.yml when a push to main
44
# is detected
55

6+
set -euo pipefail
7+
68
builddir=$1
79
sha=$2
810
github_token=$3
911

10-
git config user.email "mapserverbot@mapserver.bot"
11-
git config user.name "MapServer deploybot"
12+
git config --global user.email "mapserverbot@mapserver.bot"
13+
git config --global user.name "MapServer deploybot"
1214

13-
git clone --no-checkout --depth=1 \
14-
https://x-access-token:${github_token}@github.com/mapserver/MapServer-documentation.git \
15+
git clone --depth=1 \
16+
https://x-access-token:${github_token}@github.com/MapServer/MapServer-documentation.git \
1517
/tmp/MapServer-documentation
1618

1719
cd /tmp/MapServer-documentation
18-
git checkout -B gh-pages
20+
git fetch origin gh-pages
21+
git checkout -B gh-pages origin/gh-pages
1922

2023
# delete existing files
21-
git rm -r * --quiet || true
24+
git rm -rf --quiet --ignore-unmatch .
25+
2226

2327
# add in the new build files
24-
cp -rf "$builddir/html/"* .
28+
cp -a "$builddir/html/." .
2529
touch .nojekyll
2630

2731
git add -A
28-
git commit -m "update with results of commit https://github.com/mapserver/MapServer-documentation/commit/$sha" --quiet || echo "Nothing to commit"
29-
git push origin gh-pages --force
32+
git commit -m "update with results of commit https://github.com/MapServer/MapServer-documentation/commit/$sha" --quiet || echo "Nothing to commit"
33+
git push origin gh-pages

0 commit comments

Comments
 (0)