summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2014-08-31 02:44:21 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2014-09-01 16:29:38 +0100
commit7faa06ce0b60148bdc6e9b6df8c9c88f7d99ebb9 (patch)
treecc489e7e72cfd48ca6b3a502e24599ccc75db6f7 /scripts
parent9fdfa86200580fe9cd45689108d40981db93b618 (diff)
downloadpsycopg2-7faa06ce0b60148bdc6e9b6df8c9c88f7d99ebb9.tar.gz
Added scripts to release and upload docs
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/upload-docs.sh15
-rwxr-xr-xscripts/upload-release.sh55
2 files changed, 70 insertions, 0 deletions
diff --git a/scripts/upload-docs.sh b/scripts/upload-docs.sh
new file mode 100755
index 0000000..c450270
--- /dev/null
+++ b/scripts/upload-docs.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+DOCDIR="$DIR/../doc"
+
+# this command requires ssh configured to the proper target
+tar czf - -C "$DOCDIR/html" . | ssh psycoweb tar xzvf - -C docs/current
+
+# download the script to upload the docs to PyPI
+test -e "$DIR/pypi_docs_upload.py" \
+ || wget -O "$DIR/pypi_docs_upload.py" \
+ https://gist.githubusercontent.com/dvarrazzo/dac46237070d69dbc075/raw
+
+# this command requires a ~/.pypirc with the right privileges
+python "$DIR/pypi_docs_upload.py" psycopg2 "$DOCDIR/html"
diff --git a/scripts/upload-release.sh b/scripts/upload-release.sh
new file mode 100755
index 0000000..7ce16d8
--- /dev/null
+++ b/scripts/upload-release.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+# Script to create a psycopg release
+#
+# You must create a release tag before running the script, e.g. 2_5_4.
+# The script will check out in a clear environment, build the sdist package,
+# unpack and test it, then upload on PyPI and on the psycopg website.
+
+set -e
+
+REPO_URL=git@github.com:psycopg/psycopg2.git
+
+VER=$(grep ^PSYCOPG_VERSION setup.py | cut -d "'" -f 2)
+
+# avoid releasing a testing version
+echo "$VER" | grep -qE '^[0-9]+\.[0-9]+(\.[0-9]+)?$' \
+ || (echo "bad release: $VER" >&2 && exit 1)
+
+# Check out in a clean environment
+rm -rf rel
+mkdir rel
+cd rel
+git clone $REPO_URL psycopg
+cd psycopg
+TAG=${VER//./_}
+git checkout -b $TAG $TAG
+make env # to build the docs
+make sdist
+
+# Test the sdist just created
+cd dist
+tar xzvf psycopg2-$VER.tar.gz
+cd psycopg2-$VER
+make
+make check
+cd ../../
+
+read -p "if you are not fine with the above stop me now..."
+
+# upload to pypi and to the website
+
+python setup.py sdist --formats=gztar upload -s
+
+DASHVER=${VER//./-}
+DASHVER=${DASHVER:0:3}
+
+# Requires ssh configuration for 'psycoweb'
+scp dist/psycopg2-${VER}.tar.gz psycoweb:tarballs/PSYCOPG-${DASHVER}/
+ssh psycoweb ln -sfv PSYCOPG-${DASHVER}/psycopg2-${VER}.tar.gz \
+ tarballs/psycopg2-latest.tar.gz
+
+scp dist/psycopg2-${VER}.tar.gz.asc psycoweb:tarballs/PSYCOPG-${DASHVER}/
+ssh psycoweb ln -sfv PSYCOPG-${DASHVER}/psycopg2-${VER}.tar.gz.asc \
+ tarballs/psycopg2-latest.tar.gz.asc
+
+echo "great, now write release notes and an email!"