summaryrefslogtreecommitdiff
path: root/release.sh
diff options
context:
space:
mode:
Diffstat (limited to 'release.sh')
-rwxr-xr-xrelease.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/release.sh b/release.sh
new file mode 100755
index 00000000..8b0d5dab
--- /dev/null
+++ b/release.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# Cut a new release based on the latest CHANGES.rst entry.
+# Must be called from the `release` branch.
+
+VERSION_FILE="urllib3/__init__.py"
+CHANGES_FILE="CHANGES.rst"
+
+if [ "$(git rev-parse --abbrev-ref HEAD)" != "release" ]; then
+ echo "Must be called from the release branch."
+ exit 1
+fi
+
+git merge master --no-commit
+git checkout master -- CHANGES.rst
+sed -i '' '4,9d' CHANGES.rst
+
+version="$(grep -m1 -B1 '+++++' "$CHANGES_FILE" | head -n1 | cut -d' ' -f1)"
+perl -p -i -e "s/__version__.*/__version__ = '$(version)'/" "$(VERSION_FILE)"