docs: build zrepl.github.io on circleci

This commit is contained in:
Christian Schwarz 2020-09-12 12:28:32 +02:00
parent 2ba6aabd4a
commit 17e152c601
2 changed files with 68 additions and 7 deletions

View File

@ -214,6 +214,14 @@ workflows:
jobs: jobs:
- periodic-trigger-pipeline - periodic-trigger-pipeline
zrepl.github.io:
jobs:
- publish-zrepl-github-io:
filters:
branches:
only:
- stable
jobs: jobs:
quickcheck-docs: quickcheck-docs:
docker: docker:
@ -342,3 +350,31 @@ jobs:
body_no_shell_subst: '{"branch":"master", "parameters": { "do_ci": true, "do_release": true }}' body_no_shell_subst: '{"branch":"master", "parameters": { "do_ci": true, "do_release": true }}'
- trigger-pipeline: - trigger-pipeline:
body_no_shell_subst: '{"branch":"stable", "parameters": { "do_ci": true, "do_release": true }}' body_no_shell_subst: '{"branch":"stable", "parameters": { "do_ci": true, "do_release": true }}'
publish-zrepl-github-io:
docker:
- image: cimg/python:3.7
steps:
- checkout
- invoke-lazy-sh:
subcommand: docdep
- run:
command: |
git config --global user.email "me@cschwarz.com"
git config --global user.name "zrepl-github-io-ci"
# https://circleci.com/docs/2.0/add-ssh-key/#adding-multiple-keys-with-blank-hostnames
- run: ssh-add -D
# the default circleci ssh config only additional ssh keys for Host !github.com
- run:
command: |
cat > ~/.ssh/config \<<EOF
Host *
IdentityFile /home/circleci/.ssh/id_rsa_458e62c517f6c480e40452126ce47421
EOF
- add_ssh_keys:
fingerprints:
# deploy key for zrepl.github.io
- "45:8e:62:c5:17:f6:c4:80:e4:04:52:12:6c:e4:74:21"
- run: bash -x docs/publish.sh -c -a

View File

@ -1,14 +1,30 @@
#!/bin/bash #!/bin/bash
set -eo pipefail set -eo pipefail
NON_INTERACTIVE=false
DO_CLONE=false
while getopts "ca" arg; do
case "$arg" in
"a")
NON_INTERACTIVE=true
;;
"c")
DO_CLONE=true
;;
*)
echo invalid option
exit 1
;;
esac
done
GHPAGESREPO="git@github.com:zrepl/zrepl.github.io.git" GHPAGESREPO="git@github.com:zrepl/zrepl.github.io.git"
SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
PUBLICDIR="${SCRIPTDIR}/public_git" PUBLICDIR="${SCRIPTDIR}/public_git"
checkout_repo_msg() { checkout_repo_msg() {
echo "clone ${GHPAGESREPO} to ${PUBLICDIR}:" echo "clone ${GHPAGESREPO} to ${PUBLICDIR}:"
echo " git clone ${GHPAGESREPO} ${PUBLICDIR}"
git clone "${GHPAGESREPO}" "${PUBLICDIR}"
} }
exit_msg() { exit_msg() {
@ -25,11 +41,19 @@ cd "$SCRIPTDIR"
if [ ! -d "$PUBLICDIR" ]; then if [ ! -d "$PUBLICDIR" ]; then
checkout_repo_msg checkout_repo_msg
exit 1 if $DO_CLONE; then
git clone "${GHPAGESREPO}" "${PUBLICDIR}"
else
exit 1
fi
fi fi
echo -n "PRESS ENTER to confirm you commited and pushed docs changes and tags to the zrepl repo" if $NON_INTERACTIVE; then
read echo "non-interactive mode"
else
echo -n "PRESS ENTER to confirm you commited and pushed docs changes and tags to the zrepl repo"
read -r
fi
pushd "$PUBLICDIR" pushd "$PUBLICDIR"
@ -52,9 +76,10 @@ popd
echo "building site" echo "building site"
flags="$(python3 gen-sphinx-versioning-flags.py)"
set -e set -e
sphinx-versioning build \ sphinx-versioning build \
$(python3 gen-sphinx-versioning-flags.py) \ $flags \
docs ./public_git \ docs ./public_git \
-- -c sphinxconf # older conf.py throw errors because they used -- -c sphinxconf # older conf.py throw errors because they used
# version = subprocess.show_output(["git", "describe"]) # version = subprocess.show_output(["git", "describe"])
@ -66,7 +91,7 @@ git status --porcelain
if [[ "$(git status --porcelain)" != "" ]]; then if [[ "$(git status --porcelain)" != "" ]]; then
CURRENT_COMMIT="${CURRENT_COMMIT}(dirty)" CURRENT_COMMIT="${CURRENT_COMMIT}(dirty)"
fi fi
COMMIT_MSG="sphinx-versioning render from publish.sh - `date -u` - ${CURRENT_COMMIT}" COMMIT_MSG="sphinx-versioning render from publish.sh - $(date -u) - ${CURRENT_COMMIT}"
pushd "$PUBLICDIR" pushd "$PUBLICDIR"