mirror of
https://github.com/superhelio/tools.git
synced 2026-01-26 11:24:06 +00:00
Compare commits
70 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
778c6c4a7f | ||
|
|
a97bff4f5b | ||
|
|
41e16f232c | ||
|
|
e05ed60268 | ||
|
|
b74002d8de | ||
|
|
124d6262f7 | ||
|
|
24c4d5ae11 | ||
|
|
f929f2fcbe | ||
|
|
d096216b86 | ||
|
|
de6539cd66 | ||
|
|
741c03f48f | ||
|
|
ec1a2e4863 | ||
|
|
99a2f8b7da | ||
|
|
68884e32a0 | ||
|
|
7ec7677935 | ||
|
|
f88f86fc6e | ||
|
|
bf8762497b | ||
|
|
56e8ed92bb | ||
|
|
1917e19ea9 | ||
|
|
d891ca07b2 | ||
|
|
b0f63b22ac | ||
|
|
4ab476c6e0 | ||
|
|
175b0649c1 | ||
|
|
a62b76f1bd | ||
|
|
b6fc18b6a4 | ||
|
|
d9f2bc146b | ||
|
|
79a048ce20 | ||
|
|
a1120207ee | ||
|
|
5193045add | ||
|
|
ea7562a48d | ||
|
|
488a739643 | ||
|
|
2f85fb63a3 | ||
|
|
58abebab4f | ||
|
|
000be4feaf | ||
|
|
7b11e1d3ef | ||
|
|
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 | ||
|
|
bea29b3ce3 | ||
|
|
497fbd22a7 | ||
|
|
7514595f35 | ||
|
|
9ac3cdf1f2 | ||
|
|
5d09d34489 |
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@@ -0,0 +1,15 @@
|
||||
; This file is for unifying the coding style for different editors and IDEs.
|
||||
; More information at http://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/vendor/
|
||||
/.idea/
|
||||
91
CHANGELOG.md
91
CHANGELOG.md
@@ -1,20 +1,87 @@
|
||||
## 0.1.6 (2016-08-15)
|
||||
- Added license (MIT)
|
||||
- Expand release.sh section to contain requirements, features and usage
|
||||
- New sections is README.md: How to use, Changelog, License
|
||||
|
||||
[Full changelog](https://github.com/superhelio/tools/compare/0.1.5...0.1.6)
|
||||
|
||||
|
||||
## 0.1.5 (2016-08-15)
|
||||
- Add .editorconfig
|
||||
- Ignore .idea folder
|
||||
- Comment out unused variables (unused colors and BRANCH_CURRENT)
|
||||
- Remove extra new line before Full changelog link
|
||||
|
||||
[Full changelog](https://github.com/superhelio/tools/compare/0.1.4...0.1.5)
|
||||
|
||||
|
||||
## 0.1.4 (2016-08-11)
|
||||
- Fix changelog url generation
|
||||
|
||||
[Full changelog](https://github.com/superhelio/tools/compare/0.1.3...0.1.4)
|
||||
|
||||
|
||||
## 0.1.3 (2016-08-11)
|
||||
- Fix ssh remote url, convert to https
|
||||
- Take account diffs in bitbucket and github changelog urls
|
||||
- Reverse commit message list
|
||||
|
||||
[Full changelog](https://github.com/superhelio/tools/compare/0.1.2...0.1.3)
|
||||
|
||||
|
||||
## 0.1.2 (2016-08-10)
|
||||
- Explicitly push tags
|
||||
- Better wording to push question
|
||||
- Fix changelog url
|
||||
|
||||
[Full changelog](https://github.com/superhelio/tools/compare/0.1.1...0.1.2)
|
||||
|
||||
|
||||
## 0.1.1 (2016-08-10)
|
||||
- Echo into the temp file, not to the screen
|
||||
|
||||
[Full changelog](https://github.com/superhelio/tools/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)
|
||||
- 865447cf1637fa413056c4ed0c52a6816eb5d0a4 2016-08-04 | Minor changes to make sure nothing strange happens when releasing (HEAD -> release-0.0.4, develop) [Ismo Vuorinen]
|
||||
- f58d1c50ddc441665adc100912455f95bba21d61 2016-08-04 | Merge branch 'release-0.0.3' (tag: 0.0.3, master) [Ismo Vuorinen]
|
||||
- 6bc0934eee3ce77a09aaa0f91528d9febc871dde 2016-08-04 | Merge branch 'release-0.0.3' into develop [Ismo Vuorinen]
|
||||
- f25536b8a18cb4b46af53623b3ba89787ae7df7d 2016-08-04 | Merge branch 'release-0.0.2' (tag: 0.0.2) [Ismo Vuorinen]
|
||||
- f711b92ba293b4cb6e983d0b0cd8f2a76352c428 2016-08-04 | Merge branch 'release-0.0.1' (tag: 0.0.1) [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)
|
||||
- c23b512b808fda4c2cc9edf9f618061a553c61a6 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]
|
||||
- f25536b8a18cb4b46af53623b3ba89787ae7df7d 2016-08-04 | Merge branch 'release-0.0.2' (tag: 0.0.2, master) [Ismo Vuorinen]
|
||||
- dd0341cb923241bca5e02d4b4d1a894708cf804b 2016-08-04 | Merge branch 'release-0.0.2' into develop [Ismo Vuorinen]
|
||||
- f711b92ba293b4cb6e983d0b0cd8f2a76352c428 2016-08-04 | Merge branch 'release-0.0.1' (tag: 0.0.1) [Ismo Vuorinen]
|
||||
- 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)
|
||||
- f711b92ba293b4cb6e983d0b0cd8f2a76352c428 2016-08-04 | Merge branch 'release-0.0.1' (tag: 0.0.1, master) [Ismo Vuorinen]
|
||||
- 997beeebb0ba05c60590ecf96cb18fc1e58a336a 2016-08-04 | Merge branch 'release-0.0.1' into develop (HEAD -> release-0.0.2, develop) [Ismo Vuorinen]
|
||||
- Changed date format on release header
|
||||
|
||||
## 0.0.1 (Elokuu 04, 2016)
|
||||
- Uncomment rest of the script
|
||||
|
||||
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 SuperHelio Oy <hello@superhelio.com>
|
||||
|
||||
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
> of this software and associated documentation files (the "Software"), to deal
|
||||
> in the Software without restriction, including without limitation the rights
|
||||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
> copies of the Software, and to permit persons to whom the Software is
|
||||
> furnished to do so, subject to the following conditions:
|
||||
>
|
||||
> The above copyright notice and this permission notice shall be included in
|
||||
> all copies or substantial portions of the Software.
|
||||
>
|
||||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
> THE SOFTWARE.
|
||||
27
README.md
Normal file
27
README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# SuperHelio Tools
|
||||
|
||||
Collection of cool tools that make life easier.
|
||||
|
||||
## The tools
|
||||
|
||||
- [release.sh](release.sh) - [Git Flow](http://nvie.com/posts/a-successful-git-branching-model/) release flow with automatic version bumping and changelog updating.
|
||||
- **Requires:** `bash`, `git` and `sed`
|
||||
- **Features:**
|
||||
- Helps you [keep your CHANGELOG.md up to date](http://keepachangelog.com/): Lists your commit messages, gives you a change to modify results before committing.
|
||||
- Supports GitHub and Bitbucket tag comparison urls
|
||||
- **Usage:**
|
||||
- Commit everything, run `release.sh` and follow directions
|
||||
|
||||
## How to use in your project
|
||||
|
||||
We try to keep this as easy as possible to include to your projects, so we are open to pull requests.
|
||||
|
||||
Currently we have [composer.json](composer.json) that installs the tools to your `vendor/bin` folder, you can [include the project as git submodule](https://gist.github.com/gitaarik/8735255) or just copy the files to your project. Which ever works best for you.
|
||||
|
||||
## Changelog
|
||||
|
||||
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. We use [release.sh](release.sh) to update the CHANGELOG.
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
|
||||
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"
|
||||
]
|
||||
}
|
||||
86
release.sh
86
release.sh
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Git-flow release automation with
|
||||
# version bumping and changelog generation
|
||||
@@ -10,22 +10,27 @@
|
||||
|
||||
# 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')"
|
||||
RED="\033[1;31m"
|
||||
GREEN="\033[0;32m"
|
||||
YELLOW="\033[1;33m"
|
||||
BLUE="\033[1;34m"
|
||||
PURPLE="\033[1;35m"
|
||||
#BLUE="\033[1;34m"
|
||||
#PURPLE="\033[1;35m"
|
||||
CYAN="\033[1;36m"
|
||||
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. Used to create Changelog link.
|
||||
# You can change this to your project url, but detection should cover 99%.
|
||||
PROJECT_URL=$(git config --get remote.origin.url | sed 's/\.git//' | sed 's/\:/\//' | sed 's/git@/https\:\/\//' | sed 's/\/\/\//\:\/\//')
|
||||
|
||||
# current Git branch
|
||||
BRANCH_CURRENT=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
|
||||
#BRANCH_CURRENT=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
|
||||
|
||||
# establish branch and tag name variables
|
||||
BRANCH_DEV=develop
|
||||
@@ -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
|
||||
@@ -62,7 +67,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 +76,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,52 +96,77 @@ 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"
|
||||
|
||||
# Fix compare url based on BitBucket or Github, default to GitHub
|
||||
if [[ "$PROJECT_URL" == *bitbucket.org* ]]; then
|
||||
# https://bitbucket.org/vendor/project/branches/compare/_NEW_%0D_OLD_
|
||||
VER_COMP_STR='branches/compare'
|
||||
VER_COMP_SEP='%0D'
|
||||
VER_COMP_TAG="$NEW_VERSION$VER_COMP_SEP$BASE_STRING"
|
||||
else
|
||||
# https://github.com/vendor/project/compare/_OLD_..._NEW_
|
||||
VER_COMP_STR='compare'
|
||||
VER_COMP_SEP='...'
|
||||
VER_COMP_TAG="$BASE_STRING$VER_COMP_SEP$NEW_VERSION"
|
||||
fi
|
||||
|
||||
# Create our changelog
|
||||
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 | sed -n '1!G;h;$p' >> tmpfile
|
||||
echo "" >> tmpfile
|
||||
echo "[Full changelog]($PROJECT_URL/$VER_COMP_STR/$VER_COMP_TAG)" >> 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 everything to origin?"
|
||||
|
||||
read -r PUSH
|
||||
if [[ $PUSH =~ [yY](es)* ]] || [ "$PUSH" = "" ]; then
|
||||
git push --all origin
|
||||
git push --tags origin
|
||||
fi
|
||||
|
||||
echo -e "${NOTICE_FLAG} Done!"
|
||||
|
||||
Reference in New Issue
Block a user