Skip to content

Instantly share code, notes, and snippets.

@ttddyy
Created March 22, 2016 21:45
Show Gist options
  • Save ttddyy/45f87408134ae6872d72 to your computer and use it in GitHub Desktop.
Save ttddyy/45f87408134ae6872d72 to your computer and use it in GitHub Desktop.
Prepare release for xenon
#! /bin/sh -xe
# Prepare release for xenon
# - create a branch "prepare-release-${RELEASE_VERSION}"
# - update CHANGELOG.md versions
# - update pom versions
# - create local commits for release and next dev versions
#
# TODO: change to receive args and validate
#
XENON_LOCAL_REPO=/Users/ttsuyukubo/repo/vmw/xenon-release
RELEASE_VERSION=0.7.5
NEXT_DEV_VERSION=0.7.6-SNAPSHOT
CHANGE_LOG_FILE=CHANGELOG.md
cd ${XENON_LOCAL_REPO}
# check clean or not
if [ -z "$(git status --porcelain)" ]; then
# Working directory clean
echo "${XENON_LOCAL_REPO} is clean"
else
# Uncommitted changes
echo "${XENON_LOCAL_REPO} is dirty"
exit 1;
fi
git pull --rebase
git checkout -b prepare-release-${RELEASE_VERSION}
# create release version
sed -i '' "s/^##.*-SNAPSHOT */## ${RELEASE_VERSION}/" ${CHANGE_LOG_FILE}
./mvnw versions:set -DgenerateBackupPoms=false -DnewVersion=${RELEASE_VERSION}
git commit -a -m "Mark ${RELEASE_VERSION} for release"
# create next developmenet version
sed -i '' "1d" ${CHANGE_LOG_FILE}
sed -i '' "1i\\
# CHANGELOG\\
\\
## ${NEXT_DEV_VERSION}\\
" ${CHANGE_LOG_FILE}
./mvnw versions:set -DgenerateBackupPoms=false -DnewVersion=${NEXT_DEV_VERSION}
git commit -a -m "Mark ${NEXT_DEV_VERSION} for development"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment