diff --git a/git-retag.sh b/git-retag.sh index 15e96de..b6dbf61 100755 --- a/git-retag.sh +++ b/git-retag.sh @@ -144,13 +144,17 @@ for tag in $OLDTAGS ; do -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` +VERSION_RELEASE_LONG=`rpm --queryformat '%{version} %{release}\n' --specfile $REPO_NAME.spec` +VERSION_RELEASE=${VERSION_RELEASE_LONG%%$'\n'*} VERSION=${VERSION_RELEASE% *} -REST=${VERSION_RELEASE#* } -RELEASE=${REST#* } -# 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) +RELEASE=${VERSION_RELEASE#* } TAG=$VERSION"-"${RELEASE%.*} +if [ $DEBUG ] ; then + echo "VERSION_RELEASE=$VERSION_RELEASE" + echo "VERSION=$VERSION" + echo "RELEASE=$RELEASE" + echo "TAG=$TAG" +fi git pull git tag -a $TAG -m "Setting tag to current Version-Release in spec file: $TAG" git push origin --tag $TAG $QUIET