-
Notifications
You must be signed in to change notification settings - Fork 27
/
update-gh-pages-branch.sh
executable file
·53 lines (43 loc) · 1.47 KB
/
update-gh-pages-branch.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
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
#
# This file is part of postpic.
#
# postpic is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# postpic is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with postpic. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright Stephan Kuschel, 2020
# This script creates the documentation as html and saves it to the
# "gh-pages" branch.
set -eux
# ensure Working Directory is clean
git diff-index --quiet HEAD
if ! git rev-parse --verify --quiet gh-pages; then
current_branch=$(git branch --show-current)
echo 'create empty and orphan gh-pages branch'
git checkout --orphan gh-pages
git reset
git commit --allow-empty --no-verify -m "init empty gh-pages branch"
git checkout -f $current_branch
fi
# assert that Working Directory is still clean
git diff-index --quiet HEAD
SHA=$(git rev-parse --verify HEAD)
# create documentation on gh-pages branch
rm -rf doc/build/html
git worktree add -f doc/build/html gh-pages
cd doc
make html
cd build/html
touch .nojekyll
git add .
git commit -a --no-verify -m "postpic documentation at $SHA"