Last active
August 29, 2015 14:02
-
-
Save jamiepenney/11a1b7c7e686df0e9a16 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
SERVER="your octopus server here" | |
APIKEY="your api key here" | |
VERSION="" | |
TEST=0 | |
REUSE_NOTES=0 | |
DEPLOY_TARGET="Office" | |
DEPLOY_ONLY=0 | |
while getopts "v:tre:d" opt; do | |
case $opt in | |
v) | |
VERSION=$OPTARG | |
;; | |
t) | |
TEST=1 | |
;; | |
r) | |
REUSE_NOTES=1 | |
;; | |
e) | |
DEPLOY_TARGET=$OPTARG | |
;; | |
d) | |
REUSE_NOTES=1 | |
DEPLOY_ONLY=1 | |
;; | |
esac | |
done | |
shift $((OPTIND-1)) | |
[ "$1" = "--" ] && shift | |
nl=$'\n' | |
branch=`git symbolic-ref --short HEAD` | |
user=`id -u -n` | |
if [ $REUSE_NOTES -eq 0 ] | |
then | |
rm -f /tmp/releasenotes | |
echo "# $branch $nl* $nl#### $user" > /tmp/releasenotes | |
fi | |
if [ $DEPLOY_ONLY -eq 0 ] | |
then | |
vim +2 /tmp/releasenotes | |
fi | |
while [[ $# -gt 0 ]] | |
do | |
command="octo create-release --project=\"$1\" --packageversion=\"$VERSION\" --releasenotesfile=/tmp/releasenotes --deployto=$DEPLOY_TARGET --server=$SERVER --apiKey=$APIKEY" | |
if [ $DEPLOY_ONLY -eq 1 ] | |
then | |
command="octo deploy-release --project=\"$1\" --releaseNumber=\"$VERSION\" --deployto=$DEPLOY_TARGET --server=$SERVER --apiKey=$APIKEY" | |
fi | |
if [ $TEST -eq 0 ] | |
then | |
eval $command | |
else | |
echo $command | |
fi | |
shift | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment