-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/bash | ||
|
||
set +e | ||
|
||
# | ||
# Set Colors | ||
# | ||
|
||
bold="\e[1m" | ||
dim="\e[2m" | ||
underline="\e[4m" | ||
blink="\e[5m" | ||
reset="\e[0m" | ||
red="\e[31m" | ||
green="\e[32m" | ||
blue="\e[34m" | ||
|
||
# | ||
# Common Output Styles | ||
# | ||
|
||
h1() { | ||
printf "\n${bold}${underline}%s${reset}\n" "$(echo "$@" | sed '/./,$!d')" | ||
} | ||
h2() { | ||
printf "\n${bold}%s${reset}\n" "$(echo "$@" | sed '/./,$!d')" | ||
} | ||
info() { | ||
printf "${dim}➜ %s${reset}\n" "$(echo "$@" | sed '/./,$!d')" | ||
} | ||
success() { | ||
printf "${green}✔ %s${reset}\n" "$(echo "$@" | sed '/./,$!d')" | ||
} | ||
error() { | ||
printf "${red}${bold}✖ %s${reset}\n" "$(echo "$@" | sed '/./,$!d')" | ||
} | ||
warnError() { | ||
printf "${red}✖ %s${reset}\n" "$(echo "$@" | sed '/./,$!d')" | ||
} | ||
warnNotice() { | ||
printf "${blue}✖ %s${reset}\n" "$(echo "$@" | sed '/./,$!d')" | ||
} | ||
note() { | ||
printf "\n${bold}${blue}Note:${reset} ${blue}%s${reset}\n" "$(echo "$@" | sed '/./,$!d')" | ||
} | ||
|
||
typeExists() { | ||
if [ $(type -P $1) ]; then | ||
return 0 | ||
fi | ||
return 1 | ||
} | ||
|
||
if ! typeExists "git-chglog"; then | ||
error "git-chglog is not installed" | ||
note "To install run: go get -u github.com/git-chglog/git-chglog/cmd/git-chglog" | ||
exit 1 | ||
fi | ||
|
||
VERSION=${1} | ||
|
||
if [ "x${VERSION}x" = "xx" ]; then | ||
error "Must supply version number as first argument" | ||
exit 1 | ||
fi | ||
|
||
h1 "Preparing release of $VERSION" | ||
|
||
h2 "Updating docs" | ||
make docs | ||
if [[ "$(git status -s docs/hev.* 2>/dev/null | wc -l)" == "0" ]]; then | ||
note "No changes to docs" | ||
else | ||
note "Committing changes to docs" | ||
git add docs/hev.* | ||
git commit -m "chore(docs): updating docs for version $VERSION" | ||
fi | ||
|
||
h2 "Updating CHANGELOG.md" | ||
git-chglog --next-tag $VERSION -o CHANGELOG.md && git add CHANGELOG.md | ||
git commit -m "feat(release): $VERSION" | ||
|
||
h2 "Tagging version: $VERSION" | ||
git tag $VERSION | ||
|
||
note "Pushing branch: git push origin $(git rev-parse --abbrev-ref HEAD)" | ||
git push origin $(git rev-parse --abbrev-ref HEAD) | ||
|
||
note "Pushing tag: git push origin $VERSION" | ||
git push origin $VERSION | ||
|
||
success "Done!" |