Skip to content

Commit 3ad3567

Browse files
committed
enh: establish a documentation deployment protocol
This new protocol should give an end to the expensive builds on circle CI, as old versions do not need to be rebuilt with every tag / push to master. After squashing the history again, and probably cleaning up git objects that are not used, this should effectively reduce the checkout time by a lot. Resolves: #557.
1 parent 92b6fb8 commit 3ad3567

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

.github/workflows/builddocs.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ name: Build docs
33

44
on:
55
push:
6-
branches: [ '*' ]
6+
branches: [ 'doc/*', 'docs/*' ]
77
tags: [ '*' ]
88
pull_request:
99
branches: [ master, 'maint/*' ]
1010

11+
create:
12+
tags: [ '*' ]
13+
1114
jobs:
1215
build:
1316
if: "!contains(github.event.head_commit.message, '[skip ci]')"
@@ -44,3 +47,36 @@ jobs:
4447
- name: Build docs
4548
run: |
4649
make -C docs/ SPHINXOPTS="-W" BUILDDIR="$HOME/docs" CURBRANCH="${CURBRANCH:-html}" html
50+
51+
- name: Push created tag to gh-pages
52+
if: github.event_name == 'create'
53+
run: |
54+
MAJOR_MINOR=${CURBRANCH%.*}
55+
if [[ "${MAJOR_MINOR" == "" ]]; then
56+
echo "Could not identify release series"
57+
exit 1
58+
fi
59+
git checkout gh-pages
60+
git pull
61+
git rm -r ${MAJOR_MINOR}/
62+
# It is fundamental that the directory does not exist at all.
63+
rm -rf ${MAJOR_MINOR}
64+
cp -r $HOME/docs/$CURBRANCH $PWD/${MAJOR_MINOR}
65+
git commit -am "rel(${CURBRANCH}): Update docs of ${MAJOR_MINOR} series" || true
66+
git push
67+
68+
- name: Push merge commit into master to gh-pages
69+
if: github.event.pull_request.merged == true
70+
run: |
71+
if [[ "${CURBRANCH" != "master" ]]; then
72+
echo "$CURBRANCH is not the default development branch"
73+
exit 1
74+
fi
75+
git checkout gh-pages
76+
git pull
77+
git rm -r master/
78+
# It is fundamental that the directory does not exist at all.
79+
rm -rf master
80+
cp -r $HOME/docs/$CURBRANCH $PWD/master
81+
git commit -am "docs(master): Update docs of development line" || true
82+
git push

0 commit comments

Comments
 (0)