Skip to content

Instantly share code, notes, and snippets.

@flavioribeiro
Created December 12, 2016 20:15
Show Gist options
  • Select an option

  • Save flavioribeiro/a5479d51ac3aa93903809ec5a74b665b to your computer and use it in GitHub Desktop.

Select an option

Save flavioribeiro/a5479d51ac3aa93903809ec5a74b665b to your computer and use it in GitHub Desktop.
diff --git bump.sh Users/207112/golang/src/github.com/NYTimes/video-transcoding-api/bump.sh
index cc26af4..443e185 100755
--- bump.sh
+++ Users/207112/golang/src/github.com/NYTimes/video-transcoding-api/bump.sh
@@ -1,8 +1,8 @@
#!/bin/bash
PROJECT=$(git config --local remote.origin.url|sed -n 's#.*/\([^.]*\)\.git#\1#p')
-GH_LOG_TEMPLATE="([%h](https://github.com/nytm/$PROJECT/commit/%h)) %s %n"
-EMAIL_LOG_TEMPLATE="[<a href=https://github.com/nytm/$PROJECT/commit/%h>%h</a>] %s - by %an, %ci.<br>"
+GH_LOG_TEMPLATE="([%h](https://github.com/nytimes/$PROJECT/commit/%h)) %s %n"
+EMAIL_LOG_TEMPLATE="[<a href=https://github.com/nytimes/$PROJECT/commit/%h>%h</a>] %s - by %an, %ci.<br>"
RECIPIENT=mediafactory@nytimes.com
increment_version() {
@@ -18,7 +18,11 @@ increment_version() {
((arr[2]++))
fi
- echo "${arr[0]}.${arr[1]}.${arr[2]}"
+ if [ "$3" == "prd" ]; then
+ echo "${arr[0]}.${arr[1]}.${arr[2]}"
+ else
+ echo "${arr[0]}.${arr[1]}.${arr[2]}-rc"
+ fi
}
update_changelog() {
@@ -43,7 +47,7 @@ send_mail() {
HEADER="<img src=http://flv.io/mf.png><h2>Changelog</h2>"
BODY=$(cat .tmp_mail)
- FOOTER="You can also see the full changelog on <a href=https://github.com/nytm/$PROJECT/blob/master/CHANGELOG.md>GitHub</a>.<br><br>Media Factory Team."
+ FOOTER="You can also see the full changelog on <a href=https://github.com/NYTimes/$PROJECT/blob/master/CHANGELOG.md>GitHub</a>.<br><br>Media Factory Team."
MESSAGE="${HEADER}<br>${BODY}<br>${FOOTER}"
SUBJECT="$TITLE\nFrom: Media Factory <mediafactory@nytimes.com>\nContent-Type: text/html\n"
@@ -56,7 +60,7 @@ if [ "$1" != "" ]; then
read -p "You're about to bump a new version and push to master. Is that what you intended? [y|n] " -n 1 -r < /dev/tty
if echo $REPLY | grep -E '^[Yy]$' > /dev/null; then
last_version=$(git describe --tags $(git rev-list --tags --max-count=1))
- new_version=$(increment_version $last_version $1)
+ new_version=$(increment_version $last_version $1 $2)
git checkout master
git pull --rebase
@@ -67,6 +71,6 @@ if [ "$1" != "" ]; then
echo " Bump aborted."
fi
else
- echo "Usage: ./bump.sh [major|minor|bugfix]"
+ echo "Usage: ./bump.sh (major|minor|bugfix) [prd]"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment