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}
GITEAHOST=${remote_GITEAHOST}
NOISY=
CLEAN=
EXTRAPARAMS=
for param in $3 $4 $5 $6 ; do
if [ $param ] ; then
@ -65,6 +66,8 @@ for param in $3 $4 $5 $6 ; do
DEBUG=true ;;
noisy )
NOISY=true ;;
clean )
CLEAN=true ;;
* )
echo "Unkown parameter: $param"
exit 1
@ -130,19 +133,16 @@ else
fi
cd $GITFiles/$REPO_NAME
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
# 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" )
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'*}