mirror of
https://github.com/superhelio/tools.git
synced 2026-01-26 03:14:00 +00:00
Merge branch 'release-0.0.10'
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
## 0.0.10 (2016-08-04)
|
||||
- db2367d 2016-08-04 | Create the README.md (HEAD -> release-0.0.10, develop) [Ismo Vuorinen]
|
||||
- 0140b53 2016-08-04 | Implement [shellcheck](https://www.shellcheck.net/) recommendations [Ismo Vuorinen]
|
||||
- eb48964 2016-08-04 | Check for the first commit [Ismo Vuorinen]
|
||||
- 5bf9c8f 2016-08-04 | Use env to detect bash path [Ismo Vuorinen]
|
||||
|
||||
## 0.0.9 (2016-08-04)
|
||||
- 72d3fe5 2016-08-04 | Changed git log hash length (HEAD -> release-0.0.9, develop) [Ismo Vuorinen]
|
||||
- 94cefa4 2016-08-04 | Remove merges from git log command output [Ismo Vuorinen]
|
||||
|
||||
7
README.md
Normal file
7
README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# SuperHelio Tools
|
||||
|
||||
Collection of cool tools that make life easier.
|
||||
|
||||
## Scripts
|
||||
|
||||
- [release.sh](https://github.com/superhelio/tools/blob/master/release.sh) - Git Flow release flow with automatic version bumping
|
||||
49
release.sh
49
release.sh
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Git-flow release automation with
|
||||
# version bumping and changelog generation
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
# file in which to update version number
|
||||
FILE_VERSION="VERSION"
|
||||
# file to use as our change log
|
||||
FILE_CHANGELOG="CHANGELOG.md"
|
||||
|
||||
NOW="$(date +'%Y-%m-%d')"
|
||||
@@ -22,7 +23,7 @@ CYAN="\033[1;36m"
|
||||
WHITE="\033[1;37m"
|
||||
RESET="\033[0m"
|
||||
|
||||
LATEST_HASH=`git log --pretty=format:'%h' -n 1`
|
||||
LATEST_HASH=$(git log --pretty=format:'%h' -n 1)
|
||||
|
||||
# current Git branch
|
||||
BRANCH_CURRENT=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
|
||||
@@ -41,16 +42,16 @@ ADJUSTMENTS_MSG="${QUESTION_FLAG} ${CYAN}Now you can make adjustments to ${WHITE
|
||||
PUSHING_MSG="${NOTICE_FLAG} Pushing new version to the ${WHITE}origin${CYAN}..."
|
||||
|
||||
|
||||
#if [ ! $LATEST_HASH ]; then
|
||||
# echo -e "${ERROR_FLAG} No commits in the repo. Cannot continue."
|
||||
# exit 1
|
||||
#fi
|
||||
if [ ! "$LATEST_HASH" ]; then
|
||||
echo -e "${ERROR_FLAG} No commits in the repo. Cannot continue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Do we have a file with our version?
|
||||
if [ ! -f $FILE_VERSION ]; then
|
||||
echo -ne "${QUESTION_FLAG} ${CYAN}Can't find version file (${FILE_VERSION}), create one?"
|
||||
|
||||
read RESPONSE
|
||||
read -r RESPONSE
|
||||
if [[ $RESPONSE =~ [yY](es)* ]] || [ "$RESPONSE" = "" ]; then
|
||||
echo "0.0.0" > $FILE_VERSION
|
||||
else
|
||||
@@ -62,7 +63,7 @@ fi
|
||||
if [ ! -f $FILE_CHANGELOG ]; then
|
||||
echo -ne "${QUESTION_FLAG} ${CYAN}Can't find changelog file (${FILE_CHANGELOG}), create one?"
|
||||
|
||||
read RESPONSE
|
||||
read -r RESPONSE
|
||||
if [[ $RESPONSE =~ [yY](es)* ]] || [ "$RESPONSE" = "" ]; then
|
||||
echo "" > $FILE_CHANGELOG
|
||||
else
|
||||
@@ -71,13 +72,13 @@ if [ ! -f $FILE_CHANGELOG ]; then
|
||||
fi
|
||||
|
||||
# Continue to guess new value for our version
|
||||
BASE_STRING=`cat $FILE_VERSION`
|
||||
BASE_STRING=$(cat $FILE_VERSION)
|
||||
|
||||
if [ $BASE_STRING = "" ]; then
|
||||
if [ "$BASE_STRING" = "" ]; then
|
||||
BASE_STRING="0.0.0"
|
||||
fi
|
||||
|
||||
BASE_LIST=(`echo $BASE_STRING | tr '.' ' '`)
|
||||
BASE_LIST=($(echo $BASE_STRING | tr '.' ' '))
|
||||
V_MAJOR=${BASE_LIST[0]}
|
||||
V_MINOR=${BASE_LIST[1]}
|
||||
V_PATCH=${BASE_LIST[2]}
|
||||
@@ -91,59 +92,59 @@ V_PATCH=$((V_PATCH + 1))
|
||||
|
||||
SUGGESTED_VERSION="$V_MAJOR.$V_MINOR.$V_PATCH"
|
||||
echo -ne "${QUESTION_FLAG} ${CYAN}Enter a version number [${WHITE}$SUGGESTED_VERSION${CYAN}]: "
|
||||
read NEW_VERSION
|
||||
read -r NEW_VERSION
|
||||
if [ "$NEW_VERSION" = "" ]; then
|
||||
NEW_VERSION=$SUGGESTED_VERSION
|
||||
fi
|
||||
echo -e "${NOTICE_FLAG} Will set new version to be ${WHITE}$NEW_VERSION"
|
||||
echo ""
|
||||
echo -ne "${WARNING_FLAG} This is the last chance to bail out before anything has happened."
|
||||
read
|
||||
read -r
|
||||
|
||||
# Set up our release branch name
|
||||
BRANCH_RELEASE=release-$NEW_VERSION
|
||||
|
||||
# create the release branch from the -develop branch
|
||||
git checkout -b $BRANCH_RELEASE $BRANCH_DEV
|
||||
git checkout -b "$BRANCH_RELEASE" "$BRANCH_DEV"
|
||||
|
||||
# Set our new version to our version file
|
||||
echo $NEW_VERSION > $FILE_VERSION
|
||||
echo "$NEW_VERSION" > "$FILE_VERSION"
|
||||
|
||||
# Create our changelog
|
||||
echo "## $NEW_VERSION ($NOW)" > tmpfile
|
||||
git log --pretty=format:" - %h %ad | %s%d [%an]" --date=short --no-merges "$BASE_STRING"...HEAD >> tmpfile
|
||||
echo "" >> tmpfile
|
||||
echo "" >> tmpfile
|
||||
cat $FILE_CHANGELOG >> tmpfile
|
||||
cat "$FILE_CHANGELOG" >> tmpfile
|
||||
mv tmpfile $FILE_CHANGELOG
|
||||
|
||||
echo -e "$ADJUSTMENTS_MSG"
|
||||
read
|
||||
read -r
|
||||
echo -e "$PUSHING_MSG"
|
||||
|
||||
# Make sure changes have been added
|
||||
git add $FILE_VERSION $FILE_CHANGELOG
|
||||
git add "$FILE_VERSION" "$FILE_CHANGELOG"
|
||||
|
||||
# Commit version number increment
|
||||
git commit -am "Incrementing version number to $NEW_VERSION"
|
||||
|
||||
# Merge release branch with the new version number into master
|
||||
git checkout $BRANCH_MASTER
|
||||
git merge --no-ff $BRANCH_RELEASE
|
||||
git checkout "$BRANCH_MASTER"
|
||||
git merge --no-ff "$BRANCH_RELEASE"
|
||||
|
||||
# Create tag for new version from -master
|
||||
git tag -am "Tag version ${NEW_VERSION}." "$NEW_VERSION"
|
||||
|
||||
# Merge release branch with the new version number back into develop
|
||||
git checkout $BRANCH_DEV
|
||||
git merge --no-ff $BRANCH_RELEASE
|
||||
git checkout "$BRANCH_DEV"
|
||||
git merge --no-ff "$BRANCH_RELEASE"
|
||||
|
||||
# Remove release branch
|
||||
git branch -d $BRANCH_RELEASE
|
||||
git branch -d "$BRANCH_RELEASE"
|
||||
|
||||
echo -ne "${QUESTION_FLAG} ${CYAN}Push?"
|
||||
|
||||
read PUSH
|
||||
read -r PUSH
|
||||
if [[ $PUSH =~ [yY](es)* ]] || [ "$PUSH" = "" ]; then
|
||||
git push --all origin
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user