Skip to content

Commit

Permalink
CI #4 construct new gh-pages branch
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Jan 2, 2023
1 parent 03f13fc commit 373c394
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
13 changes: 13 additions & 0 deletions .github/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="15; url='https://prjemian.github.io/pysumreg/dev'" />
</head>
<body>
<p>
Click <a href="https://prjemian.github.io/pysumreg/dev/">here</a>
or wait 15 seconds to redirect automatically to documentation of
the latest release.
</p>
</body>
</html>
36 changes: 33 additions & 3 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,46 @@ jobs:
echo "--------------- diagnostic pip list ---------------"
pip list
# TODO: could write to tmp directory
- name: Make Temporary Directory for Sphinx content
run: |
echo "TEMPDIR=$(mktemp -d)" >> ${GITHUB_ENV}
echo "VERSION=$(./setup.py --version)" >> ${GITHUB_ENV}
- name: Show Environment variables
run: |
echo "TEMPDIR=${TEMPDIR}"
echo "VERSION=${VERSION}"
- name: Sphinx
run: |
make -C docs html
sphinx-build -M html ./docs/source "${TEMPDIR}/build"
- name: Build gh-pages content
run: |
# get the new docs
pushd "${TEMPDIR}"
mv ./build/html "./${VERSION}"
ln -s "./${VERSION}" ./dev
/bin/rm -rf ./build
popd
# get the redirect page
# TODO: change "/dev" to "/latest"
cp ./.github/index.html "${TEMPDIR}"
# make the switcher file
mkdir "${TEMPDIR}/_static"
# TODO: build this file dynamically
cp ./docs/source/_static/switcher.json "${TEMPDIR}/_static"
# diagnostic
ls -lAFgh "${TEMPDIR}"
- name: Deploy (to gh-pages branch) only on demand
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event.inputs.deploy }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html
publish_dir: "${TEMPDIR}"
force_orphan: true

0 comments on commit 373c394

Please sign in to comment.