forked from testingisdocumenting/webtau
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-gh-pages.sh
executable file
·37 lines (25 loc) · 818 Bytes
/
update-gh-pages.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
set -eux
GIT_URL=$(git config --get remote.origin.url)
GH_PAGES_BRANCH=gh-pages
ROOT_DIR=$(dirname $0)
GH_PAGES_DIR=$ROOT_DIR/gh-pages
# Find the webtau version
WEBTAU_VERSION=$(grep \<version\> $ROOT_DIR/pom.xml | head -1 | cut -d'>' -f2 | cut -d'<' -f1)
# Cleanup on exit
cleanup() {
rm -rf $GH_PAGES_DIR
}
trap cleanup EXIT
git clone $GIT_URL --branch $GH_PAGES_BRANCH --single-branch --depth 1 $GH_PAGES_DIR
# Cleanup existing pages
rm -rf $GH_PAGES_DIR/guide/*
rm -rf $GH_PAGES_DIR/znaisrc/*
# Copy in new pages
cp -r $ROOT_DIR/webtau-docs/target/guide/* $GH_PAGES_DIR/guide/
cp -r $ROOT_DIR/webtau-docs/target/znaisrc/* $GH_PAGES_DIR/znaisrc/
cd $GH_PAGES_DIR
# Tell git about changed, new and deleted pages
git add -A
git commit -m "Updating docs for $WEBTAU_VERSION"
git push