mirror of
https://github.com/superhelio/tools.git
synced 2026-01-30 20:46:39 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea7562a48d | ||
|
|
2f85fb63a3 | ||
|
|
58abebab4f | ||
|
|
000be4feaf | ||
|
|
7b11e1d3ef | ||
|
|
bfec35ece4 | ||
|
|
c2ccbbf08f | ||
|
|
ec78cb8335 | ||
|
|
06677cea39 | ||
|
|
a0b8fa91c8 | ||
|
|
ce422a3072 | ||
|
|
a50e43b811 | ||
|
|
e93a5b8207 | ||
|
|
db2367df53 | ||
|
|
0140b539f5 | ||
|
|
eb4896403a | ||
|
|
5bf9c8fc5f | ||
|
|
a5206fa4b1 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/vendor/
|
||||||
19
CHANGELOG.md
19
CHANGELOG.md
@@ -1,3 +1,22 @@
|
|||||||
|
## 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)
|
## 0.0.9 (2016-08-04)
|
||||||
- 72d3fe5 2016-08-04 | Changed git log hash length (HEAD -> release-0.0.9, develop) [Ismo Vuorinen]
|
- 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]
|
- 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
|
||||||
16
composer.json
Normal file
16
composer.json
Normal 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"
|
||||||
|
]
|
||||||
|
}
|
||||||
57
release.sh
57
release.sh
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Git-flow release automation with
|
# Git-flow release automation with
|
||||||
# version bumping and changelog generation
|
# version bumping and changelog generation
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
# file in which to update version number
|
# file in which to update version number
|
||||||
FILE_VERSION="VERSION"
|
FILE_VERSION="VERSION"
|
||||||
|
# file to use as our change log
|
||||||
FILE_CHANGELOG="CHANGELOG.md"
|
FILE_CHANGELOG="CHANGELOG.md"
|
||||||
|
|
||||||
NOW="$(date +'%Y-%m-%d')"
|
NOW="$(date +'%Y-%m-%d')"
|
||||||
@@ -22,7 +23,11 @@ CYAN="\033[1;36m"
|
|||||||
WHITE="\033[1;37m"
|
WHITE="\033[1;37m"
|
||||||
RESET="\033[0m"
|
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
|
# current Git branch
|
||||||
BRANCH_CURRENT=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
|
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}..."
|
PUSHING_MSG="${NOTICE_FLAG} Pushing new version to the ${WHITE}origin${CYAN}..."
|
||||||
|
|
||||||
|
|
||||||
#if [ ! $LATEST_HASH ]; then
|
if [ ! "$LATEST_HASH" ]; then
|
||||||
# echo -e "${ERROR_FLAG} No commits in the repo. Cannot continue."
|
echo -e "${ERROR_FLAG} No commits in the repo. Cannot continue."
|
||||||
# exit 1
|
exit 1
|
||||||
#fi
|
fi
|
||||||
|
|
||||||
# Do we have a file with our version?
|
# Do we have a file with our version?
|
||||||
if [ ! -f $FILE_VERSION ]; then
|
if [ ! -f $FILE_VERSION ]; then
|
||||||
echo -ne "${QUESTION_FLAG} ${CYAN}Can't find version file (${FILE_VERSION}), create one?"
|
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
|
if [[ $RESPONSE =~ [yY](es)* ]] || [ "$RESPONSE" = "" ]; then
|
||||||
echo "0.0.0" > $FILE_VERSION
|
echo "0.0.0" > $FILE_VERSION
|
||||||
else
|
else
|
||||||
@@ -62,7 +67,7 @@ fi
|
|||||||
if [ ! -f $FILE_CHANGELOG ]; then
|
if [ ! -f $FILE_CHANGELOG ]; then
|
||||||
echo -ne "${QUESTION_FLAG} ${CYAN}Can't find changelog file (${FILE_CHANGELOG}), create one?"
|
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
|
if [[ $RESPONSE =~ [yY](es)* ]] || [ "$RESPONSE" = "" ]; then
|
||||||
echo "" > $FILE_CHANGELOG
|
echo "" > $FILE_CHANGELOG
|
||||||
else
|
else
|
||||||
@@ -71,13 +76,13 @@ if [ ! -f $FILE_CHANGELOG ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Continue to guess new value for our version
|
# 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"
|
BASE_STRING="0.0.0"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BASE_LIST=(`echo $BASE_STRING | tr '.' ' '`)
|
BASE_LIST=($(echo $BASE_STRING | tr '.' ' '))
|
||||||
V_MAJOR=${BASE_LIST[0]}
|
V_MAJOR=${BASE_LIST[0]}
|
||||||
V_MINOR=${BASE_LIST[1]}
|
V_MINOR=${BASE_LIST[1]}
|
||||||
V_PATCH=${BASE_LIST[2]}
|
V_PATCH=${BASE_LIST[2]}
|
||||||
@@ -91,59 +96,61 @@ V_PATCH=$((V_PATCH + 1))
|
|||||||
|
|
||||||
SUGGESTED_VERSION="$V_MAJOR.$V_MINOR.$V_PATCH"
|
SUGGESTED_VERSION="$V_MAJOR.$V_MINOR.$V_PATCH"
|
||||||
echo -ne "${QUESTION_FLAG} ${CYAN}Enter a version number [${WHITE}$SUGGESTED_VERSION${CYAN}]: "
|
echo -ne "${QUESTION_FLAG} ${CYAN}Enter a version number [${WHITE}$SUGGESTED_VERSION${CYAN}]: "
|
||||||
read NEW_VERSION
|
read -r NEW_VERSION
|
||||||
if [ "$NEW_VERSION" = "" ]; then
|
if [ "$NEW_VERSION" = "" ]; then
|
||||||
NEW_VERSION=$SUGGESTED_VERSION
|
NEW_VERSION=$SUGGESTED_VERSION
|
||||||
fi
|
fi
|
||||||
echo -e "${NOTICE_FLAG} Will set new version to be ${WHITE}$NEW_VERSION"
|
echo -e "${NOTICE_FLAG} Will set new version to be ${WHITE}$NEW_VERSION"
|
||||||
echo ""
|
echo ""
|
||||||
echo -ne "${WARNING_FLAG} This is the last chance to bail out before anything has happened."
|
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
|
# Set up our release branch name
|
||||||
BRANCH_RELEASE=release-$NEW_VERSION
|
BRANCH_RELEASE=release-$NEW_VERSION
|
||||||
|
|
||||||
# create the release branch from the -develop branch
|
# 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
|
# Set our new version to our version file
|
||||||
echo $NEW_VERSION > $FILE_VERSION
|
echo "$NEW_VERSION" > "$FILE_VERSION"
|
||||||
|
|
||||||
# Create our changelog
|
# Create our changelog
|
||||||
echo "## $NEW_VERSION ($NOW)" > tmpfile
|
echo "## $NEW_VERSION ($NOW)" > tmpfile
|
||||||
git log --pretty=format:" - %h %ad | %s%d [%an]" --date=short --no-merges "$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
|
||||||
echo "" >> tmpfile
|
echo "" >> tmpfile
|
||||||
cat $FILE_CHANGELOG >> tmpfile
|
cat "$FILE_CHANGELOG" >> tmpfile
|
||||||
mv tmpfile $FILE_CHANGELOG
|
mv tmpfile $FILE_CHANGELOG
|
||||||
|
|
||||||
echo -e "$ADJUSTMENTS_MSG"
|
echo -e "$ADJUSTMENTS_MSG"
|
||||||
read
|
read -r
|
||||||
echo -e "$PUSHING_MSG"
|
echo -e "$PUSHING_MSG"
|
||||||
|
|
||||||
# Make sure changes have been added
|
# Make sure changes have been added
|
||||||
git add $FILE_VERSION $FILE_CHANGELOG
|
git add "$FILE_VERSION" "$FILE_CHANGELOG"
|
||||||
|
|
||||||
# Commit version number increment
|
# Commit version number increment
|
||||||
git commit -am "Incrementing version number to $NEW_VERSION"
|
git commit -am "Incrementing version number to $NEW_VERSION"
|
||||||
|
|
||||||
# Merge release branch with the new version number into master
|
# Merge release branch with the new version number into master
|
||||||
git checkout $BRANCH_MASTER
|
git checkout "$BRANCH_MASTER"
|
||||||
git merge --no-ff $BRANCH_RELEASE
|
git merge --no-ff "$BRANCH_RELEASE"
|
||||||
|
|
||||||
# Create tag for new version from -master
|
# Create tag for new version from -master
|
||||||
git tag -am "Tag version ${NEW_VERSION}." "$NEW_VERSION"
|
git tag -am "Tag version ${NEW_VERSION}." "$NEW_VERSION"
|
||||||
|
|
||||||
# Merge release branch with the new version number back into develop
|
# Merge release branch with the new version number back into develop
|
||||||
git checkout $BRANCH_DEV
|
git checkout "$BRANCH_DEV"
|
||||||
git merge --no-ff $BRANCH_RELEASE
|
git merge --no-ff "$BRANCH_RELEASE"
|
||||||
|
|
||||||
# Remove release branch
|
# Remove release branch
|
||||||
git branch -d $BRANCH_RELEASE
|
git branch -d "$BRANCH_RELEASE"
|
||||||
|
|
||||||
echo -ne "${QUESTION_FLAG} ${CYAN}Push?"
|
echo -ne "${QUESTION_FLAG} ${CYAN}Push?"
|
||||||
|
|
||||||
read PUSH
|
read -r PUSH
|
||||||
if [[ $PUSH =~ [yY](es)* ]] || [ "$PUSH" = "" ]; then
|
if [[ $PUSH =~ [yY](es)* ]] || [ "$PUSH" = "" ]; then
|
||||||
git push --all origin
|
git push --all origin
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user