]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Trigger docs build on push
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 12 Nov 2020 15:24:18 +0000 (15:24 +0000)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 12 Nov 2020 17:56:42 +0000 (17:56 +0000)
.travis.yml
tools/travis_update_docs.sh [new file with mode: 0755]

index 5e51fb07b577dba41388b32d4f33dc6c7fabe57c..4beb545c71a6bfda6c1269735d201fac48c1853d 100644 (file)
@@ -104,6 +104,7 @@ matrix:
         - PGVER=12
         - PSYCOPG3_IMPL=ctypes
         - PGPORT=5433
+        - BUILD_DOCS=1
 
 install:
   - pip install tox
@@ -111,3 +112,10 @@ install:
 
 script:
   - tox -c $TOXDIR
+
+deploy:
+  - provider: script
+    script: bash scripts/travis_update_docs.sh
+    on:
+      branch: master
+      condition: "$BUILD_DOCS = 1"
diff --git a/tools/travis_update_docs.sh b/tools/travis_update_docs.sh
new file mode 100755 (executable)
index 0000000..90dbaa5
--- /dev/null
@@ -0,0 +1,23 @@
+#!/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 DOC3_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
+
+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\": \"${TRAVIS_BRANCH}\"}}" \
+    https://api.travis-ci.org/repo/psycopg%2Fpsycopg-website/requests