diff --git a/git-retag.sh b/git-retag.sh index b6dbf61..a509a95 100755 --- a/git-retag.sh +++ b/git-retag.sh @@ -52,6 +52,7 @@ GITEAUser=${remote_USER} GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN} GITEAHOST=${remote_GITEAHOST} NOISY= +CLEAN= EXTRAPARAMS= for param in $3 $4 $5 $6 ; do if [ $param ] ; then @@ -62,11 +63,13 @@ for param in $3 $4 $5 $6 ; do GITEAHOST=${local_GITEAHOST} ;; debug ) - DEBUG=true ;; - noisy ) - NOISY=true ;; - * ) - echo "Unkown parameter: $param" + DEBUG=true ;; + noisy ) + NOISY=true ;; + clean ) + CLEAN=true ;; + * ) + echo "Unkown parameter: $param" exit 1 ;; esac @@ -130,19 +133,16 @@ else fi cd $GITFiles/$REPO_NAME -# read the existing tags -OLDTAGS=$(git tag --list) -# delete old tag/s -for tag in $OLDTAGS ; do -# git tag --delete $tag -# git push origin --delete $tag -# for some reason the remote delete is rejected, so were using the gitea API call instead - if [[ $DEBUG ]] ; then echo "curl $checkSSL $SILENT4CURL -X 'DELETE' '$GITEAHOST/api/v1/orgs/$ORGGITEA/$REPO_NAME/tags/$tag' -H 'accept: application/json' -H 'Authorization: token $GITEAACCESSTOKEN'" ; fi - RESPONSE=$(curl "$checkSSL" "$SILENT4CURL" -X 'DELETE' \ - "$GITEAHOST/api/v1/orgs/$ORGGITEA/$REPO_NAME/tags/$tag" \ - -H 'accept: application/json' \ - -H "Authorization: token $GITEAACCESSTOKEN" ) -done +if [ $CLEAN ] ; then + # read the existing tags + OLDTAGS=$(git tag --list) + # delete old tag/s + for tag in $OLDTAGS ; do + git tag --delete $tag + git push origin --delete $tag + git push --tags + done +fi # Now create the version and release tag from the specfile VERSION_RELEASE_LONG=`rpm --queryformat '%{version} %{release}\n' --specfile $REPO_NAME.spec` VERSION_RELEASE=${VERSION_RELEASE_LONG%%$'\n'*}