diff --git a/git-retag.sh b/git-retag.sh index e034e3b..4090d91 100755 --- a/git-retag.sh +++ b/git-retag.sh @@ -134,7 +134,14 @@ cd $GITFiles/$REPO_NAME OLDTAGS=$(git tag --list) # delete old tag/s for tag in $OLDTAGS ; do - git tag --delete $tag +# 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 # Now create the version and release tag from the specfile VERSION_RELEASE=`rpm --queryformat '%{version} %{release}\n' --specfile $REPO_NAME.spec` @@ -143,8 +150,9 @@ RELEASE=${VERSION_RELEASE#* } # Release is not reliable - if you run on Rocky it comes back EL8, centos 7 - EL7 # So, we need to just take the build part (first word) TAG=$VERSION"-"${RELEASE%.*} +git pull git tag -a $TAG -m "Setting tag to current Version-Release in spec file: $TAG" -git push --tags origin $QUIET +git push origin --tag $TAG $QUIET -echo "Current $ORGGITEA/REPO_NAME tagged as $TAG - old tags removed" +echo "Current $ORGGITEA/$REPO_NAME tagged as $TAG - old tags removed" exit 0