File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ set -e
4+
35create_release (){
46 local USERNAME=$1
57 local REPOSITORY=$2
@@ -14,10 +16,9 @@ create_release(){
1416 "prerelease": true
1517 }'
1618 local PAYLOAD=$( printf " $PAYLOAD " $APP_VERSION $APP_VERSION $APP_VERSION " $DESC " )
17- local TAG_ID=$( \
18- curl -i -s -f -X POST " https://api.github.com/repos/${USERNAME} /${REPOSITORY} /releases?access_token=$REPO_TOKEN " \
19- --data " $PAYLOAD " | grep -o -E ' id": [0-9]+' | awk ' {print $2}' | head -n 1 \
20- )
19+ curl -i -s -X POST " https://api.github.com/repos/${USERNAME} /${REPOSITORY} /releases?access_token=$REPO_TOKEN " \
20+ --data " $PAYLOAD "
21+ local TAG_ID=$( echo " " | grep -o -E ' id": [0-9]+' | awk ' {print $2}' | head -n 1)
2122 echo " > Release created with id $TAG_ID " >&2
2223 echo $TAG_ID
2324}
@@ -32,9 +33,14 @@ validate_repo_token(){
3233}
3334
3435create_tag (){
36+ git config user.email
" [email protected] " 37+ git config user.name " Travis CI"
38+
39+ git commit -a -m " Releasing ${APP_VERSION} "
40+ git tag ${APP_VERSION}
41+
3542 REMOTE=" https://${REPO_TOKEN} @github.com/${USERNAME} /${REPOSITORY} .git"
36- git tag ${APP_VERSION} -a -m " Releasing ${APP_VERSION} "
37- git push " $REMOTE " --tags
43+ git push " $REMOTE " " $CURRENT_BRANCH :$CURRENT_BRANCH " --tags
3844 git status
3945 echo " > Pushed"
4046}
@@ -43,21 +49,26 @@ create_tag(){
4349USERNAME=$2
4450REPOSITORY=$3
4551APP_VERSION=$4
52+ CURRENT_BRANCH=$5
4653
4754echo " > USERNAME=${USERNAME} , REPOSITORY=${REPOSITORY} , APP_VERSION=${APP_VERSION} "
4855
4956case $1 in
5057
5158 release )
5259
53-
5460 validate_repo_token
5561
5662 create_tag
5763
5864 create_release $USERNAME $REPOSITORY $APP_VERSION
5965
6066 ;;
67+
68+ create-tag )
69+ create_tag
70+ ;;
71+
6172 create-release )
6273 create_release $USERNAME $REPOSITORY $APP_VERSION
6374 ;;
You can’t perform that action at this time.
0 commit comments