add clean option

This commit is contained in:
Trevor Batley 2024-03-11 21:01:54 +11:00
parent 9916c56721
commit a90599279b

View File

@ -52,6 +52,7 @@ GITEAUser=${remote_USER}
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN} GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
GITEAHOST=${remote_GITEAHOST} GITEAHOST=${remote_GITEAHOST}
NOISY= NOISY=
CLEAN=
EXTRAPARAMS= EXTRAPARAMS=
for param in $3 $4 $5 $6 ; do for param in $3 $4 $5 $6 ; do
if [ $param ] ; then if [ $param ] ; then
@ -65,6 +66,8 @@ for param in $3 $4 $5 $6 ; do
DEBUG=true ;; DEBUG=true ;;
noisy ) noisy )
NOISY=true ;; NOISY=true ;;
clean )
CLEAN=true ;;
* ) * )
echo "Unkown parameter: $param" echo "Unkown parameter: $param"
exit 1 exit 1
@ -130,19 +133,16 @@ else
fi fi
cd $GITFiles/$REPO_NAME cd $GITFiles/$REPO_NAME
# read the existing tags if [ $CLEAN ] ; then
OLDTAGS=$(git tag --list) # read the existing tags
# delete old tag/s OLDTAGS=$(git tag --list)
for tag in $OLDTAGS ; do # delete old tag/s
# git tag --delete $tag for tag in $OLDTAGS ; do
# git push origin --delete $tag git tag --delete $tag
# for some reason the remote delete is rejected, so were using the gitea API call instead git push origin --delete $tag
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 git push --tags
RESPONSE=$(curl "$checkSSL" "$SILENT4CURL" -X 'DELETE' \ done
"$GITEAHOST/api/v1/orgs/$ORGGITEA/$REPO_NAME/tags/$tag" \ fi
-H 'accept: application/json' \
-H "Authorization: token $GITEAACCESSTOKEN" )
done
# Now create the version and release tag from the specfile # Now create the version and release tag from the specfile
VERSION_RELEASE_LONG=`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_RELEASE=${VERSION_RELEASE_LONG%%$'\n'*}