mirror of
https://github.com/superhelio/tools.git
synced 2026-01-30 09:46:29 +00:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
000be4feaf | ||
|
|
bfec35ece4 | ||
|
|
c2ccbbf08f | ||
|
|
ec78cb8335 | ||
|
|
06677cea39 | ||
|
|
a0b8fa91c8 | ||
|
|
ce422a3072 | ||
|
|
a50e43b811 | ||
|
|
e93a5b8207 | ||
|
|
db2367df53 | ||
|
|
0140b539f5 | ||
|
|
eb4896403a | ||
|
|
5bf9c8fc5f | ||
|
|
32f1d3b58f | ||
|
|
a5206fa4b1 | ||
|
|
cb5c3234f9 | ||
|
|
72d3fe5a12 | ||
|
|
94cefa42a8 | ||
|
|
2a88069212 | ||
|
|
ad212fa78d | ||
|
|
dc6136d132 | ||
|
|
c80d8afa94 | ||
|
|
964866a2e3 | ||
|
|
6b020a6fbf | ||
|
|
07ee9ad6a2 | ||
|
|
64c82d61cd | ||
|
|
9408ec3c5d | ||
|
|
a9fa72574a | ||
|
|
92412a5006 | ||
|
|
0fa05f5f9e | ||
|
|
5af80c229c | ||
|
|
497fbd22a7 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/vendor/
|
||||||
35
CHANGELOG.md
35
CHANGELOG.md
@@ -1,12 +1,39 @@
|
|||||||
|
## 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)
|
## 0.0.5 (2016-08-04)
|
||||||
- 9ac3cdf1f2ad87a24756614369b6911e4232ac0d 2016-08-04 | Final message to show we are done (HEAD -> release-0.0.5, origin/develop, develop) [Ismo Vuorinen]
|
- 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)
|
## 0.0.4 (2016-08-04)
|
||||||
- 865447cf1637fa413056c4ed0c52a6816eb5d0a4 2016-08-04 | Minor changes to make sure nothing strange happens when releasing (HEAD -> release-0.0.4, develop) [Ismo Vuorinen]
|
- 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)
|
## 0.0.3 (2016-08-04)
|
||||||
- c23b512b808fda4c2cc9edf9f618061a553c61a6 2016-08-04 | If our changelog is missing, create one? (HEAD -> release-0.0.3, develop) [Ismo Vuorinen]
|
- c23b512 2016-08-04 | If our changelog is missing, create one? (HEAD -> release-0.0.3, develop) [Ismo Vuorinen]
|
||||||
- e4f313a05698acdb55ec30538eab0477b26c0063 2016-08-04 | Add missing changelog file [Ismo Vuorinen]
|
- e4f313a 2016-08-04 | Add missing changelog file [Ismo Vuorinen]
|
||||||
|
|
||||||
## 0.0.2 (2016-08-04)
|
## 0.0.2 (2016-08-04)
|
||||||
- Changed date format on release header
|
- Changed date format on release header
|
||||||
|
|||||||
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"
|
||||||
|
]
|
||||||
|
}
|
||||||
62
release.sh
62
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,54 +96,63 @@ 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 "$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)"
|
||||||
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?"
|
||||||
|
|
||||||
|
read -r PUSH
|
||||||
|
if [[ $PUSH =~ [yY](es)* ]] || [ "$PUSH" = "" ]; then
|
||||||
|
git push --all origin
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "${NOTICE_FLAG} Done!"
|
echo -e "${NOTICE_FLAG} Done!"
|
||||||
|
|||||||
Reference in New Issue
Block a user