fix version release
This commit is contained in:
parent
eaf957da50
commit
ce14ed07fc
27
git-retag.sh
27
git-retag.sh
@ -46,6 +46,8 @@ done < "$inifilename"
|
|||||||
DEBUG=
|
DEBUG=
|
||||||
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
||||||
|
|
||||||
|
REPO_NAME=$1
|
||||||
|
ORGGITEA=$2
|
||||||
GITEAUser=${remote_USER}
|
GITEAUser=${remote_USER}
|
||||||
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
GITEAHOST=${remote_GITEAHOST}
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
@ -96,7 +98,7 @@ else
|
|||||||
WORKDIR=${smegit_WORKDIR}
|
WORKDIR=${smegit_WORKDIR}
|
||||||
fi
|
fi
|
||||||
if [ $DEBUG ] ; then echo "WORKDIR=$WORKDIR" ; fi
|
if [ $DEBUG ] ; then echo "WORKDIR=$WORKDIR" ; fi
|
||||||
RemoteRepoURL="$GITEAHOST/$2/$1"
|
RemoteRepoURL="$GITEAHOST/$ORGGITEA/$REPO_NAME"
|
||||||
|
|
||||||
# Make sure credentials taken from store
|
# Make sure credentials taken from store
|
||||||
# The first time you pull or push it will ask for credentials and then save them in a file.
|
# The first time you pull or push it will ask for credentials and then save them in a file.
|
||||||
@ -108,27 +110,26 @@ mkdir -p $GITFiles
|
|||||||
cd $GITFiles
|
cd $GITFiles
|
||||||
|
|
||||||
# Delete the local first
|
# Delete the local first
|
||||||
if [ -d "$1" ] ; then
|
if [ -d "$REPO_NAME" ] ; then
|
||||||
if [ $DEBUG ] ; then echo "************Deleting local GIT files" ; fi
|
if [ $DEBUG ] ; then echo "************Deleting local GIT files" ; fi
|
||||||
rm -Rf $GITFiles/$1
|
rm -Rf $GITFiles/$REPO_NAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# See if it exists on the Gitea host
|
# See if it exists on the Gitea host
|
||||||
REPO_NAME=$1
|
|
||||||
if [ $DEBUG ] ; then echo "check that $GITEAHOST/$ORGGITEA/$REPO_NAME exists" ; fi
|
if [ $DEBUG ] ; then echo "check that $GITEAHOST/$ORGGITEA/$REPO_NAME exists" ; fi
|
||||||
RESPONSE=$(curl $checkSSL $SILENT4CURL -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME")
|
RESPONSE=$(curl $checkSSL $SILENT4CURL -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME")
|
||||||
if [ "$RESPONSE" == "200" ]; then
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
if [ $DEBUG ] ; then echo "************Repository for $1 exists, cloning!" ; fi
|
if [ $DEBUG ] ; then echo "************Repository for $REPO_NAME exists, cloning!" ; fi
|
||||||
# If so, clone it (just want the README.md)
|
# If so, clone it (just want the README.md)
|
||||||
if [ $DEBUG ] ; then echo "git clone $GITEAHOST/$ORGGITEA/$1.git" ; fi
|
if [ $DEBUG ] ; then echo "git clone $GITEAHOST/$ORGGITEA/$REPO_NAME.git" ; fi
|
||||||
cd $GITFiles
|
cd $GITFiles
|
||||||
git clone "$GITEAHOST/$ORGGITEA/$1.git"
|
git clone "$GITEAHOST/$ORGGITEA/$REPO_NAME.git"
|
||||||
else
|
else
|
||||||
echo "************Repository for $2/$1 does not exist. Aborting"
|
echo "************Repository for $ORGGITEA/$REPO_NAME does not exist. Aborting $RESPONSE"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $GITFiles/$1
|
cd $GITFiles/$REPO_NAME
|
||||||
# read the existing tags
|
# read the existing tags
|
||||||
OLDTAGS=$(git tag --list)
|
OLDTAGS=$(git tag --list)
|
||||||
# delete old tag/s
|
# delete old tag/s
|
||||||
@ -136,12 +137,14 @@ for tag in $OLDTAGS ; do
|
|||||||
git tag --delete $tag
|
git tag --delete $tag
|
||||||
done
|
done
|
||||||
# Now create the version and release tag from the specfile
|
# Now create the version and release tag from the specfile
|
||||||
RELEASE=`rpm --queryformat '%{release}\n' --specfile $NAME.spec | head -n 1`
|
VERSION_RELEASE=`rpm --queryformat '%{version} %{release}\n' --specfile $REPO_NAME.spec`
|
||||||
|
VERSION=${VERSION_RELEASE% *}
|
||||||
|
RELEASE=${VERSION_RELEASE#* }
|
||||||
# Release is not reliable - if you run on Rocky it comes back EL8, centos 7 - EL7
|
# 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)
|
# So, we need to just take the build part (first word)
|
||||||
TAG=$VERSION"-"${RELEASE%.*}
|
TAG=$VERSION"-"${RELEASE%.*}
|
||||||
git tag -a $TAG -m "Setting tag to current Version-Release in spec file: $TAG"
|
git tag -a $TAG -m "Setting tag to current Version-Release in spec file: $TAG"
|
||||||
git push origin $TAG $QUIET
|
git push --tags origin $QUIET
|
||||||
|
|
||||||
echo "Created $1 Repo: $HTTP_URL - Comment:$COMMENT tag:$TAG"
|
echo "Current $ORGGITEA/REPO_NAME tagged as $TAG - old tags removed"
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user