podman/hack/release.sh
W. Trevor King 96dc5fd0d5 hack/release.sh: Bump spec in dev_version_commit
Bump it to the next version (without a -dev suffix), based on the
precedent set by 70672652 (Bump to v0.6.1-dev, 2018-05-25, #834).
Previously I had VERSION there, which was a copy/paste error.

I've also added an explicit write_spec_version to release_commit.
That *should* be a no-op, with the spec version having already been
set by the previous release's dev_version_commit.  But better to be
safe than to cut a release with the wrong version number in the spec
file (e.g. maybe we guessed NEXT_VERSION wrong during the last
release).

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #879
Approved by: mheon
2018-06-01 21:39:45 +00:00

74 lines
1.6 KiB
Bash
Executable file

#!/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_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_spec_version "${VERSION}" &&
write_changelog &&
git commit -asm "Bump to v${VERSION}"
}
dev_version_commit()
{
write_go_version "${NEXT_VERSION}-dev" &&
write_spec_version "${NEXT_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}"