Skip to content

Commit

Permalink
enh: establish a documentation deployment protocol
Browse files Browse the repository at this point in the history
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: nipreps#557.
  • Loading branch information
oesteban committed Mar 1, 2022
1 parent 9d83524 commit ec573a3
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion .github/workflows/builddocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ name: Build docs

on:
push:
branches: [ '*' ]
branches: [ 'doc/*', 'docs/*' ]
tags: [ '*' ]
pull_request:
branches: [ master, 'maint/*' ]

create:
tags: [ '*' ]

jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
Expand Down Expand Up @@ -44,3 +47,36 @@ jobs:
- name: Build docs
run: |
make -C docs/ SPHINXOPTS="-W" BUILDDIR="$HOME/docs" CURBRANCH="${CURBRANCH:-html}" html
- name: Push created tag to gh-pages
if: github.event_name == 'create'
run: |
MAJOR_MINOR=${CURBRANCH%.*}
if [[ "${MAJOR_MINOR" == "" ]]; then
echo "Could not identify release series"
exit 1
fi
git checkout gh-pages
git pull
git rm -r ${MAJOR_MINOR}/
# It is fundamental that the directory does not exist at all.
rm -rf ${MAJOR_MINOR}
cp -r $HOME/docs/$CURBRANCH $PWD/${MAJOR_MINOR}
git commit -am "rel(${CURBRANCH}): Update docs of ${MAJOR_MINOR} series" || true
git push
- name: Push merge commit into master to gh-pages
if: github.event.pull_request.merged == true
run: |
if [[ "${CURBRANCH" != "master" ]]; then
echo "$CURBRANCH is not the default development branch"
exit 1
fi
git checkout gh-pages
git pull
git rm -r master/
# It is fundamental that the directory does not exist at all.
rm -rf master
cp -r $HOME/docs/$CURBRANCH $PWD/master
git commit -am "docs(master): Update docs of development line" || true
git push

0 comments on commit ec573a3

Please sign in to comment.