Skip to content

Instantly share code, notes, and snippets.

@aaalaniz
Created May 21, 2014 04:32
Show Gist options
  • Save aaalaniz/a22a73ba2572c2b57682 to your computer and use it in GitHub Desktop.
Save aaalaniz/a22a73ba2572c2b57682 to your computer and use it in GitHub Desktop.
Performing Android Release with Maven
# Create a release branch
RELEASE_VERSION=`mvn help:evaluate -Dexpression=project.version | grep -v INFO | grep SNAPSHOT | cut -d '-' -f 1`
git checkout -b release/$RELEASE_VERSION
# Prepare a release (Note we do not push any tags just yet)
mvn -B release:prepare -DpushChanges=false -DremoteTagging=false -DscmCommentPrefix= -P release
# The project has been built and now we want to deploy
# but we need to ensure our manifest stays in line with our releases
git reset HEAD~1
git checkout AndroidManifest.xml
git stash
# Deploy the release artifact
mvn deploy -P release
# At this point the manifest is correct so we want it
# in the git history
git add AndroidManifest.xml
git commit --amend --no-edit
# Cleanup and run a build with latest dev commit
# to bring manifest back up to date
git clean -f
git stash pop
mvn clean test
git add AndroidManifest.xml pom.xml
git commit -m 'kicking off next development iteration'
# I wish the release plugin made a little sense but
# we need to delete the tag it created because
# I'd rather tag in master branch
git tag -d "v$RELEASE_VERSION"
# Merge latest development iteration
git checkout development
git merge --no-ff -m "merging in next development iteration" -X theirs release/$RELEASE_VERSION
# Merge the release commit to master (note the ~1 to indicate we want the
# second to last commit)
git checkout master
git merge --no-ff -m "$RELEASE_VERSION release" -X theirs release/$RELEASE_VERSION~1
# Tag the release on master branch
git tag -a "v$RELEASE_VERSION" -m "$RELEASE_VERSION release"
# Push all updates to remote repos
git push --all && git push --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment