summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2020-01-25 18:57:46 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2020-01-25 19:51:21 +0000
commit1c80c9d8d51e67452f277a6dbe646ad99e190c7d (patch)
treea456ff59ab37c91e2154866775dc8e07a6bae525
parente9dc1df889df54c54bf798af1cf630bb2b45e495 (diff)
downloadpsycopg2-goodbye-initd.tar.gz
Trigger docs rebuild on pushgoodbye-initd
-rw-r--r--.travis.yml6
-rw-r--r--doc/Makefile4
-rwxr-xr-xscripts/travis_update_docs.sh30
3 files changed, 36 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml
index 410d06c..25c702b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,5 +20,11 @@ install:
script:
- scripts/travis_test.sh
+deploy:
+ - provider: script
+ script: bash scripts/travis_update_docs.sh
+ on:
+ branch: master
+
notifications:
email: false
diff --git a/doc/Makefile b/doc/Makefile
index 9943594..4b2752b 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -28,10 +28,6 @@ doctest:
$(MAKE) PYTHON=$(PYTHON) -C .. package
$(MAKE) $(SPHOPTS) -C src $@
-upload:
- # this command requires ssh configured to the proper target
- tar czf - -C html . | ssh psycoweb tar xzvf - -C docs/current
-
clean:
$(MAKE) $(SPHOPTS) -C src $@
rm -rf html src/sqlstate_errors.rst
diff --git a/scripts/travis_update_docs.sh b/scripts/travis_update_docs.sh
new file mode 100755
index 0000000..80aceab
--- /dev/null
+++ b/scripts/travis_update_docs.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# Trigger a rebuild of the psycopg.org website to update the documentation.
+# The script is meant to run by Travis CI.
+
+set -euo pipefail
+
+# The travis token can be set at https://travis-ci.org/psycopg/psycopg2/settings
+# and can be set on a selected branch only (which should match the DOC_BRANCH
+# in the psycopg-website Makefile, or it won't refresh a thing).
+if [ -z "${TRAVIS_TOKEN:-}" ]; then
+ echo "skipping docs update: travis token not set" >&2
+ exit 0
+fi
+
+# Avoid to rebuild the website for each matrix entry.
+want_python="3.6"
+if [ "${TRAVIS_PYTHON_VERSION}" != "${want_python}" ]; then
+ echo "skipping docs update: only updated on Python ${want_python} build" >&2
+ exit 0
+fi
+
+echo "triggering psycopg-website rebuild" >&2
+curl -s -X POST \
+ -H "Content-Type: application/json" \
+ -H "Accept: application/json" \
+ -H "Travis-API-Version: 3" \
+ -H "Authorization: token ${TRAVIS_TOKEN}" \
+ -d '{ "request": { "branch":"master" }}' \
+ https://api.travis-ci.org/repo/psycopg%2Fpsycopg-website/requests