summaryrefslogtreecommitdiff
path: root/hack/release.sh
diff options
context:
space:
mode:
authorW. Trevor King <wking@tremily.us>2018-05-31 17:00:56 -0700
committerW. Trevor King <wking@tremily.us>2018-05-31 21:04:46 -0700
commit8405ff9baa2c0ce412d5a1ff6cad7e327ade0439 (patch)
tree49437b9caf175701a65b6cb049ed3242ec947501 /hack/release.sh
parenta9e9fd4f5b56f0dd91944b86feba9a2d3814d93e (diff)
downloadpodman-8405ff9baa2c0ce412d5a1ff6cad7e327ade0439.tar.gz
podman-8405ff9baa2c0ce412d5a1ff6cad7e327ade0439.tar.bz2
podman-8405ff9baa2c0ce412d5a1ff6cad7e327ade0439.zip
hack/release.sh: Add a release script
Matthew had expressed interest in a lovely release script on IRC. Here's my attempt to encode the changes from the v0.5.4 release branch. I've also added tag signing, so you may be prompted for your passphrase during that step. The version scheme for 0.x.y is 0.${month}.${count_that_month} [1]. We could automatically calculate those with a dozen or so lines of shell script, but we don't think that's worth the maintenance burden when it's easy enough for the caller to think them up on their own [2]. The spec sed also bumps the Python package version to match, which seems like the intended behavior until 1.0 when the Python code will move into its own repository [3]. [1]: https://github.com/projectatomic/libpod/pull/867#issuecomment-393731907 [2]: https://github.com/projectatomic/libpod/pull/867#issuecomment-393743295 [3]: https://github.com/projectatomic/libpod/issues/786#issuecomment-390682012 Signed-off-by: W. Trevor King <wking@tremily.us>
Diffstat (limited to 'hack/release.sh')
-rwxr-xr-xhack/release.sh80
1 files changed, 80 insertions, 0 deletions
diff --git a/hack/release.sh b/hack/release.sh
new file mode 100755
index 000000000..01d2e81a9
--- /dev/null
+++ b/hack/release.sh
@@ -0,0 +1,80 @@
+#!/bin/sh
+#
+# Cut a libpod release. Usage:
+#
+# $ hack/release.sh <version> <next-version>
+#
+# For example:
+#
+# $ hack/release.sh 1.2.3 1.3.0
+#
+# for "I'm cutting 1.2.3, and want to use 1.3.0-dev for future work".
+
+VERSION="$1"
+NEXT_VERSION="$2"
+DATE=$(date '+%Y-%m-%d')
+LAST_TAG=$(git describe --tags --abbrev=0)
+
+write_go_version()
+{
+ LOCAL_VERSION="$1"
+ sed -i "s/^\(const Version = \"\).*/\1${LOCAL_VERSION}\"/" version/version.go
+}
+
+write_python_version()
+{
+ LOCAL_VERSION="$1"
+ sed -i "s/^\( *version='*\).*/\1${LOCAL_VERSION}'/" contrib/python/setup.py
+}
+
+write_spec_version()
+{
+ LOCAL_VERSION="$1"
+ sed -i "s/^\(Version: *\).*/\1${LOCAL_VERSION}/" contrib/spec/podman.spec.in
+}
+
+write_makefile_epoch()
+{
+ LOCAL_EPOCH="$1"
+ sed -i "s/^\(EPOCH_TEST_COMMIT ?= \).*/\1${LOCAL_EPOCH}/" Makefile
+}
+
+write_changelog()
+{
+ echo "- Changelog for v${VERSION} (${DATE})" >.changelog.txt &&
+ git log --no-merges --format=' * %s' "${LAST_TAG}..HEAD" >>.changelog.txt &&
+ echo >>.changelog.txt &&
+ cat changelog.txt >>.changelog.txt &&
+ mv -f .changelog.txt changelog.txt
+}
+
+release_commit()
+{
+ write_go_version "${VERSION}" &&
+ write_python_version "${VERSION}" &&
+ write_changelog &&
+ git commit -asm "Bump to v${VERSION}"
+}
+
+dev_version_commit()
+{
+ write_go_version "${NEXT_VERSION}-dev" &&
+ write_python_version "${NEXT_VERSION}" &&
+ write_spec_version "${VERSION}" &&
+ git commit -asm "Bump to v${NEXT_VERSION}-dev"
+}
+
+epoch_commit()
+{
+ LOCAL_EPOCH="$1"
+ write_makefile_epoch "${LOCAL_EPOCH}" &&
+ git commit -asm 'Bump gitvalidation epoch'
+}
+
+git fetch origin &&
+git checkout -b "bump-${VERSION}" origin/master &&
+EPOCH=$(git rev-parse HEAD) &&
+release_commit &&
+git tag -s -m "version ${VERSION}" "v${VERSION}" &&
+dev_version_commit &&
+epoch_commit "${EPOCH}"