Skip to content

Commit

Permalink
Chore: Modify patch release script (#250)
Browse files Browse the repository at this point in the history
Change patch release script to no longer reset to master so patches can be manually cherry-picked.
  • Loading branch information
tonyjin authored Jul 26, 2017
1 parent b3dd251 commit afc51d3
Showing 1 changed file with 44 additions and 29 deletions.
73 changes: 44 additions & 29 deletions build/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ increment_version() {
OLD_VERSION=$(./build/current_version.sh)

if $major_release; then
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Bumping major version..."
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
npm --no-git-tag-version version major
elif $minor_release; then
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Bumping minor version..."
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
npm --no-git-tag-version version minor
elif $patch_release; then
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Bumping patch version..."
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
npm --no-git-tag-version version patch
fi

Expand All @@ -67,27 +67,27 @@ increment_version() {


update_changelog() {
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Updating CHANGELOG.md"
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"

if github_changelog_generator box/box-content-preview --future-release v$VERSION --exclude-labels legacy-ignore; then
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Updated CHANGELOG successfully"
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
else
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Error: Could not update the CHANGELOG for this version"
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
return 1
fi
}


update_readme() {
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Updating README"
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"

# Replace 'v{VERSION}' string
sed -i -e "s@v$OLD_VERSION@v$VERSION@g" README.md
Expand All @@ -106,19 +106,19 @@ push_to_github() {
# Force update tag after updating files
git tag -a v$VERSION -m $VERSION

echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Master version is now at" $VERSION
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"

# Push to Github including tags
if git push github-upstream master --tags --no-verify; then
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Pushed version" $VERSION "to git successfully"
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
else
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Error while pushing version" $VERSION "to git"
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
return 1
fi
}
Expand All @@ -127,7 +127,22 @@ push_to_github() {
# Check out latest code from git, build assets, increment version, and push tags
push_new_release() {
# Get latest commited code and tags
reset_to_master || return 1
if $patch_release; then
echo "----------------------------------------------------------------------"
echo "Starting patch release - skipping reset to master"
echo "IMPORTANT - your branch should be in the state you want for the patch"
echo "----------------------------------------------------------------------"
if $minor_release; then
echo "----------------------------------------------------------------------"
echo "Starting minor release - reset to upstream master"
echo "----------------------------------------------------------------------"
reset_to_master || return 1
else
echo "----------------------------------------------------------------------"
echo "Starting major release - reset to upstream master"
echo "----------------------------------------------------------------------"
reset_to_master || return 1
fi

# Run build script, linting, and tests
build_lint_and_test || return 1
Expand Down Expand Up @@ -161,22 +176,22 @@ done

# Execute this entire script
if ! push_new_release; then
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Error while pushing new release!"
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"

echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Cleaning workspace by checking out master and removing tags"
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"

if ! reset_to_master; then
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Error while cleaning workspace!"
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
else
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "Workspace succesfully cleaned!"
echo "----------------------------------------------------"
echo "----------------------------------------------------------------------"
fi;
exit 1
fi

0 comments on commit afc51d3

Please sign in to comment.