Skip to content

Instantly share code, notes, and snippets.

@aryelgois
Last active February 15, 2019 23:56
Show Gist options
  • Save aryelgois/7160eb5eac527c9b9e75aad033d17ccb to your computer and use it in GitHub Desktop.
Save aryelgois/7160eb5eac527c9b9e75aad033d17ccb to your computer and use it in GitHub Desktop.
Automated creation of major and minor releases
#!/usr/bin/env bash
#
# Automated creation of major and minor releases
#
# Usage: release VERSION
#
# VERSION should be a semver for the next release
#
# For patch releases (i.e. hotfixes) you need to
# do manually
#
# Environment variables:
# REMOTE Remote to push the new release branch
# DEVELOP Branch with features for the release
# STAGING Branch for staging purposes
set -e
REMOTE=${REMOTE:-origin}
DEVELOP=${DEVELOP:-develop}
STAGING=${STAGING:-homologacao}
RELEASE="release/$1"
echo "Updating staging branch..."
git checkout "$STAGING"
git pull
echo
echo "Merging develop branch..."
git merge "$REMOTE/$DEVELOP" --no-ff -m "Prepare release $1"
git push
echo
echo "Creating release branch..."
git checkout -b "$RELEASE"
git push -u "$REMOTE" "$RELEASE"
@aryelgois
Copy link
Author

Install

Copy the file to a directory in your $PATH, rename to release and add the executable bit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment