Skip to content

Commit 3b2fb37

Browse files
committed
Publish documentation to GitHub Pages
The old pythonhosted.org docs hosting is deprecated now, so we needed a new hosting site. Unfortunately, RTD can't handle our use cases (customizations, requiring C libraries). Instead, we use GitHub pages. Every push to master (or an `infra/` branch for testing) will push documentation to the `/latest` subdirectory of the gh-pages site, while every tag build will push to the `/stable` directory.
1 parent 64f63c8 commit 3b2fb37

File tree

6 files changed

+104
-13
lines changed

6 files changed

+104
-13
lines changed

.travis.yml

+32-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ before_install: skip
2121
stages:
2222
- verify
2323
- test
24+
- name: deploy latest docs
25+
if: (branch = master OR branch =~ ^infra/$) AND type = push
2426
- name: deploy
2527
if: tag is PRESENT
2628

@@ -44,9 +46,30 @@ jobs:
4446
- source ./.travis/lib-util.sh
4547
- util::docker-run $DISTRO ./.travis/verify.sh
4648

49+
- stage: deploy latest docs
50+
script: skip
51+
env:
52+
- DISTRO=fedora:rawhide
53+
- PYTHON="3"
54+
- secure: L5SpEj5+no20PWwC9Y/XNhAfmUvYiuykwSMa/YyqvUuBjdizzpZcHr7Ego5nMdM1TniTxj4pSTM+GbM0FHCzNmAINSRh9g/D3hheRqlRBacqR0XwC9ZZRvkKvtzwnLh4vYWiauq4AoDeR5U6tkEcay6LjE57iMQcLjcKYBc+Eos=
55+
before_deploy:
56+
- source ./.travis/lib-util.sh
57+
- util::docker-run $DISTRO ./.travis/before-docs-deploy.sh
58+
59+
deploy:
60+
- provider: script
61+
script: .travis/docs-deploy.sh travis_docs_build/html latest pythongssapi/python-gssapi
62+
skip_cleanup: true
63+
on:
64+
all_branches: true
65+
66+
4767
- stage: deploy
4868
script: skip
49-
env: DISTRO=fedora:rawhide PYTHON="3"
69+
env:
70+
- DISTRO=fedora:rawhide
71+
- PYTHON="3"
72+
- secure: L5SpEj5+no20PWwC9Y/XNhAfmUvYiuykwSMa/YyqvUuBjdizzpZcHr7Ego5nMdM1TniTxj4pSTM+GbM0FHCzNmAINSRh9g/D3hheRqlRBacqR0XwC9ZZRvkKvtzwnLh4vYWiauq4AoDeR5U6tkEcay6LjE57iMQcLjcKYBc+Eos=
5073
before_deploy:
5174
- source ./.travis/lib-util.sh
5275
- util::docker-run $DISTRO ./.travis/before-deploy.sh
@@ -55,7 +78,7 @@ jobs:
5578
deploy:
5679
- provider: releases
5780
api_key:
58-
secure: e8kjZEY28gWySD5FsnG9CMgeKgFS12gB/xm1Ck1jEgIhYT01VwxvBMHIU7SV/92+aeBao5clN4/qN4P035hD8TShHUMzV7rsmXmqcaCwi3J5sh2hyy4e1PfYAshuX7bxvkfqJSvSonLz0AKHW4pj17yMrTXpWiEioGg0fSLtTHo=
81+
secure: fAaSSSjd/nUrIpINBjAT590pGF2nGq3I8ee6aGq6IAFpXoa/9eeN5eyOrE4MYucWCwYcH28c7510n35vuZQQor+UZIDo6l0K5M64/NZE1cZ43zOMjw3yHlrsJG+ohPS7YvjqD8GaFlLhF6ZvWvrPmWeijvs8qAT1eL7QoEG0xBk=
5982
file_glob: true
6083
file:
6184
- tag_build/*
@@ -74,3 +97,10 @@ jobs:
7497
all_branches: true
7598
# NB(directxman12): this is a hack. Check ./.travis/before-deploy.sh for an explanation.
7699
distributions: "check"
100+
101+
- provider: script
102+
script: .travis/docs-deploy.sh travis_docs_build/html stable pythongssapi/python-gssapi
103+
skip_cleanup: true
104+
on:
105+
all_branches: true
106+

.travis/before-deploy.sh

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash -ex
22

33
source ./.travis/lib-setup.sh
4+
source ./.travis/lib-deploy.sh
45

56
# build again since I can't figure out how to get travis to recognize the old
67
# build in the new container. The other alternative (besides actually solving
@@ -13,15 +14,7 @@ setup::activate
1314
yum -y install tar coreutils git
1415

1516
# build the docs
16-
# the first run is for the docs build, so don't clean up
17-
pip install -r docs-requirements.txt
18-
19-
# install dependencies so that sphinx doesn't have issues
20-
# (this actually just installs the whole package in dev mode)
21-
pip install -e .
22-
23-
# place in a non-standard location so that they don't get cleaned up
24-
python setup.py build_sphinx --build-dir travis_docs_build
17+
deploy::build-docs
2518

2619
# NB(directxman12): this is a *terrible* hack, but basically,
2720
# dpl (the Travis deployer) uses `twine` instead of `setup.py sdist upload`.

.travis/before-docs-deploy.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash -ex
2+
3+
source ./.travis/lib-setup.sh
4+
source ./.travis/lib-deploy.sh
5+
6+
# build again since I can't figure out how to get travis to recognize the old
7+
# build in the new container. The other alternative (besides actually solving
8+
# the issue) is to run the docs build and tarball generation every time.
9+
10+
./.travis/build.sh
11+
12+
setup::activate
13+
14+
deploy::build-docs

.travis/docs-deploy.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash -ex
2+
3+
# NB (very important): BE VERY CAREFUL WITH `set -x` FOR THIS FILE.
4+
# The GitHub token is sensative information, and should never
5+
# be displayed on in the clear.
6+
7+
source_directory=${1?need <source dir> <target dir> <target repo> [<target branch, default: gh-pages>]}
8+
target_directory=${2?need <source dir> <target dir> <target repo> [<target branch, default: gh-pages>]}
9+
target_repo=${3?need <source dir> <target dir> <target repo> [<target branch, default: gh-pages>]}
10+
target_branch=${4:-gh-pages}
11+
12+
desc=$(git describe --tags)
13+
14+
scratch_dir=$(mktemp -d)
15+
16+
set +x # IMPORTANT
17+
echo "cloning https://<elided>@github.com/${target_repo}.git#${target_branch} in to ${scratch_dir}/docs..."
18+
git clone https://${GITHUB_TOKEN}@github.com/${target_repo}.git ${scratch_dir}/docs -b ${target_branch}
19+
set -x
20+
21+
mkdir -p ${scratch_dir}/docs/${target_directory}
22+
cp -r ${source_directory}/. ${scratch_dir}/docs/${target_directory}
23+
echo $desc > ${scratch_dir}/docs/${target_directory}/.from
24+
pushd $scratch_dir/docs
25+
git config user.email "[email protected]"
26+
git config user.name "Deployment Bot (from Travis CI)"
27+
git add ${target_directory}
28+
git commit -m "Update ${target_directory} docs in based on ${desc}"
29+
30+
set +x # IMPORTANT
31+
echo "pushing to https://<elided>@github.com/${target_repo}.git#${target_branch}"
32+
git push --quiet --force-with-lease origin ${target_branch}:${target_branch}
33+
set -x
34+
35+
popd
36+
rm -rf ${scratch_dir}
37+
echo "done!"

.travis/lib-deploy.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
deploy::build-docs() {
2+
# the first run is for the docs build, so don't clean up
3+
pip install -r docs-requirements.txt
4+
5+
# install dependencies so that sphinx doesn't have issues
6+
# (this actually just installs the whole package in dev mode)
7+
pip install -e .
8+
9+
# place in a non-standard location so that they don't get cleaned up
10+
python setup.py build_sphinx --build-dir travis_docs_build
11+
12+
echo "travis_docs_build"
13+
}

README.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ Python-GSSAPI provides both low-level and high level wrappers around the GSSAPI
2121
C libraries. While it focuses on the Kerberos mechanism, it should also be
2222
useable with other GSSAPI mechanisms.
2323

24-
Documentation for the latest released version can be found at
25-
`https://pythonhosted.org/gssapi <https://pythonhosted.org/gssapi>`_.
24+
Documentation for the latest released version (including pre-release versions)
25+
can be found at
26+
`https://pythongssapi.github.io/python-gssapi/stable <https://pythongssapi.github.io/python-gssapi/stable>`_.
27+
28+
Documentation for the latest commit on master can be found at
29+
`https://pythongssapi.github.io/python-gssapi/latest <https://pythongssapi.github.io/python-gssapi/latest>`_.
2630

2731
Requirements
2832
============

0 commit comments

Comments
 (0)