52 Commits
0.0.1 ... 0.1.1

Author SHA1 Message Date
Ismo Vuorinen
ea7562a48d Merge branch 'release-0.1.1' 2016-08-10 13:45:42 +03:00
Ismo Vuorinen
2f85fb63a3 Incrementing version number to 0.1.1 2016-08-10 13:45:42 +03:00
Ismo Vuorinen
58abebab4f Echo into the temp file, not to the screen 2016-08-10 13:44:42 +03:00
Ismo Vuorinen
000be4feaf Merge branch 'release-0.1.0' 2016-08-10 13:43:45 +03:00
Ismo Vuorinen
7b11e1d3ef Merge branch 'release-0.1.0' into develop 2016-08-10 13:43:45 +03:00
Ismo Vuorinen
bfec35ece4 Incrementing version number to 0.1.0 2016-08-10 13:43:45 +03:00
Ismo Vuorinen
c2ccbbf08f Remove paging from git log, works better for automation 2016-08-10 13:41:05 +03:00
Ismo Vuorinen
ec78cb8335 Change changelog formatting to simple message 2016-08-10 13:40:32 +03:00
Ismo Vuorinen
06677cea39 Add link to full changelog, detect project url from origin url 2016-08-10 13:38:57 +03:00
Ismo Vuorinen
a0b8fa91c8 Add composer.json, ignore vendor folder 2016-08-10 13:38:22 +03:00
Ismo Vuorinen
ce422a3072 Merge branch 'release-0.0.10' 2016-08-04 19:13:59 +03:00
Ismo Vuorinen
a50e43b811 Merge branch 'release-0.0.10' into develop 2016-08-04 19:13:59 +03:00
Ismo Vuorinen
e93a5b8207 Incrementing version number to 0.0.10 2016-08-04 19:13:59 +03:00
Ismo Vuorinen
db2367df53 Create the README.md 2016-08-04 19:13:24 +03:00
Ismo Vuorinen
0140b539f5 Implement [shellcheck](https://www.shellcheck.net/) recommendations 2016-08-04 19:12:59 +03:00
Ismo Vuorinen
eb4896403a Check for the first commit 2016-08-04 19:11:45 +03:00
Ismo Vuorinen
5bf9c8fc5f Use env to detect bash path 2016-08-04 19:11:22 +03:00
Ismo Vuorinen
32f1d3b58f Merge branch 'release-0.0.9' 2016-08-04 17:17:14 +03:00
Ismo Vuorinen
a5206fa4b1 Merge branch 'release-0.0.9' into develop 2016-08-04 17:17:14 +03:00
Ismo Vuorinen
cb5c3234f9 Incrementing version number to 0.0.9 2016-08-04 17:17:14 +03:00
Ismo Vuorinen
72d3fe5a12 Changed git log hash length 2016-08-04 17:16:11 +03:00
Ismo Vuorinen
94cefa42a8 Remove merges from git log command output 2016-08-04 17:14:38 +03:00
Ismo Vuorinen
2a88069212 Fixed pushing 2016-08-04 17:11:56 +03:00
Ismo Vuorinen
ad212fa78d Merge branch 'release-0.0.8' 2016-08-04 17:10:24 +03:00
Ismo Vuorinen
dc6136d132 Merge branch 'release-0.0.8' into develop 2016-08-04 17:10:24 +03:00
Ismo Vuorinen
c80d8afa94 Incrementing version number to 0.0.8 2016-08-04 17:10:24 +03:00
Ismo Vuorinen
964866a2e3 Push master and dev branches explicitly 2016-08-04 17:09:38 +03:00
Ismo Vuorinen
6b020a6fbf Merge branch 'release-0.0.7' 2016-08-04 17:07:24 +03:00
Ismo Vuorinen
07ee9ad6a2 Merge branch 'release-0.0.7' into develop 2016-08-04 17:07:24 +03:00
Ismo Vuorinen
64c82d61cd Incrementing version number to 0.0.7 2016-08-04 17:07:24 +03:00
Ismo Vuorinen
9408ec3c5d Change pushing to do all 2016-08-04 17:06:47 +03:00
Ismo Vuorinen
a9fa72574a Merge branch 'release-0.0.6' 2016-08-04 17:04:03 +03:00
Ismo Vuorinen
92412a5006 Merge branch 'release-0.0.6' into develop 2016-08-04 17:04:03 +03:00
Ismo Vuorinen
0fa05f5f9e Incrementing version number to 0.0.6 2016-08-04 17:04:03 +03:00
Ismo Vuorinen
5af80c229c Ask should we push to origin, with tags 2016-08-04 17:03:36 +03:00
Ismo Vuorinen
bea29b3ce3 Merge branch 'release-0.0.5' 2016-08-04 16:58:10 +03:00
Ismo Vuorinen
497fbd22a7 Merge branch 'release-0.0.5' into develop 2016-08-04 16:58:10 +03:00
Ismo Vuorinen
7514595f35 Incrementing version number to 0.0.5 2016-08-04 16:58:10 +03:00
Ismo Vuorinen
9ac3cdf1f2 Final message to show we are done 2016-08-04 16:54:38 +03:00
Ismo Vuorinen
f8af60b6b1 Merge branch 'release-0.0.4' 2016-08-04 16:45:20 +03:00
Ismo Vuorinen
5d09d34489 Merge branch 'release-0.0.4' into develop 2016-08-04 16:45:20 +03:00
Ismo Vuorinen
73859c9cf3 Incrementing version number to 0.0.4 2016-08-04 16:45:20 +03:00
Ismo Vuorinen
865447cf16 Minor changes to make sure nothing strange happens when releasing 2016-08-04 16:44:53 +03:00
Ismo Vuorinen
f58d1c50dd Merge branch 'release-0.0.3' 2016-08-04 16:41:17 +03:00
Ismo Vuorinen
6bc0934eee Merge branch 'release-0.0.3' into develop 2016-08-04 16:41:17 +03:00
Ismo Vuorinen
cfe7c1b525 Incrementing version number to 0.0.3 2016-08-04 16:41:17 +03:00
Ismo Vuorinen
c23b512b80 If our changelog is missing, create one? 2016-08-04 16:40:25 +03:00
Ismo Vuorinen
e4f313a056 Add missing changelog file 2016-08-04 16:39:44 +03:00
Ismo Vuorinen
f25536b8a1 Merge branch 'release-0.0.2' 2016-08-04 16:36:59 +03:00
Ismo Vuorinen
dd0341cb92 Merge branch 'release-0.0.2' into develop 2016-08-04 16:36:59 +03:00
Ismo Vuorinen
252e031286 Incrementing version number to 0.0.2 2016-08-04 16:36:59 +03:00
Ismo Vuorinen
997beeebb0 Merge branch 'release-0.0.1' into develop 2016-08-04 16:32:11 +03:00
6 changed files with 132 additions and 26 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/vendor/

51
CHANGELOG.md Normal file
View File

@@ -0,0 +1,51 @@
## 0.1.1 (2016-08-10)
- Echo into the temp file, not to the screen
[Full changelog](https://github.com/superhelio/tools.git/compare/0.1.0...0.1.1)
## 0.1.0 (2016-08-10)
- Remove paging from git log, works better for automation
- Change changelog formatting to simple message
- Add link to full changelog, detect project url from origin url
- Add composer.json, ignore vendor folder
## 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]
- 2a88069 2016-08-04 | Fixed pushing [Ismo Vuorinen]
## 0.0.8 (2016-08-04)
- 964866a 2016-08-04 | Push master and dev branches explicitly (HEAD -> release-0.0.8, develop) [Ismo Vuorinen]
## 0.0.7 (2016-08-04)
- 9408ec3 2016-08-04 | Change pushing to do all (HEAD -> release-0.0.7, develop) [Ismo Vuorinen]
## 0.0.6 (2016-08-04)
- 5af80c2 2016-08-04 | Ask should we push to origin, with tags (HEAD -> release-0.0.6, develop) [Ismo Vuorinen]
## 0.0.5 (2016-08-04)
- 9ac3cdf 2016-08-04 | Final message to show we are done (HEAD -> release-0.0.5, origin/develop, develop) [Ismo Vuorinen]
## 0.0.4 (2016-08-04)
- 865447c 2016-08-04 | Minor changes to make sure nothing strange happens when releasing (HEAD -> release-0.0.4, develop) [Ismo Vuorinen]
## 0.0.3 (2016-08-04)
- c23b512 2016-08-04 | If our changelog is missing, create one? (HEAD -> release-0.0.3, develop) [Ismo Vuorinen]
- e4f313a 2016-08-04 | Add missing changelog file [Ismo Vuorinen]
## 0.0.2 (2016-08-04)
- Changed date format on release header
## 0.0.1 (Elokuu 04, 2016)
- Uncomment rest of the script
- Remove "-f" force option, keeping it simple
- Add our empty VERSION file to generate another commit
- First commit to get things rolling

7
README.md Normal file
View 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

View File

@@ -1 +1 @@
0.0.1
0.1.1

16
composer.json Normal file
View File

@@ -0,0 +1,16 @@
{
"name": "superhelio/tools",
"description": "Collection of our tools",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Ismo Vuorinen",
"email": "ismo.vuorinen@superhelio.com"
}
],
"require": {},
"bin": [
"release.sh"
]
}

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Git-flow release automation with
# version bumping and changelog generation
@@ -10,9 +10,10 @@
# file in which to update version number
FILE_VERSION="VERSION"
# file to use as our change log
FILE_CHANGELOG="CHANGELOG.md"
NOW="$(date +'%B %d, %Y')"
NOW="$(date +'%Y-%m-%d')"
RED="\033[1;31m"
GREEN="\033[0;32m"
YELLOW="\033[1;33m"
@@ -22,7 +23,11 @@ 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)
# Guess our remote url from remote.origin.url (minus .git from the end),
# change to your github project url. used to create Full changelog link
PROJECT_URL=$(git config --get remote.origin.url | sed 's/^\.git*//')
# current Git branch
BRANCH_CURRENT=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
@@ -41,16 +46,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
@@ -58,14 +63,26 @@ if [ ! -f $FILE_VERSION ]; then
fi
fi
# Continue to guess new value for our version
BASE_STRING=`cat $FILE_VERSION`
# Do we have a file with our changes?
if [ ! -f $FILE_CHANGELOG ]; then
echo -ne "${QUESTION_FLAG} ${CYAN}Can't find changelog file (${FILE_CHANGELOG}), create one?"
if [ $BASE_STRING = "" ]; then
read -r RESPONSE
if [[ $RESPONSE =~ [yY](es)* ]] || [ "$RESPONSE" = "" ]; then
echo "" > $FILE_CHANGELOG
else
exit 1
fi
fi
# Continue to guess new value for our version
BASE_STRING=$(cat $FILE_VERSION)
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]}
@@ -79,49 +96,63 @@ 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:" - %s" "$BASE_STRING"...HEAD >> tmpfile
git --no-pager log --pretty=format:" - %s" --date=short --no-merges "$BASE_STRING"...HEAD >> tmpfile
echo "" >> tmpfile
echo "[Full changelog]($PROJECT_URL/compare/$BASE_STRING...$NEW_VERSION)" >> 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"
# 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 $NEW_VERSION
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 -r PUSH
if [[ $PUSH =~ [yY](es)* ]] || [ "$PUSH" = "" ]; then
git push --all origin
fi
echo -e "${NOTICE_FLAG} Done!"