Skip to content

Commit

Permalink
Allow annotated tags in versionbump
Browse files Browse the repository at this point in the history
Annoted tags are needed for "git describe".

Try to replicate the header of "osc vc" by using date.
  • Loading branch information
tomschr committed Sep 18, 2023
1 parent d05851a commit 43e92e3
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions versionbump
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ currentversion=$(sed -r -n "s/^version: *($format)\$/\1/ p" $config)
files=$(sed -r -n 's/^files: *(([-_./a-zA-Z0-9]+ *)+)/\1/ p' $config)
changes=$(sed -r -n 's/^changesfile: *(([-_./a-zA-Z0-9]+ *)+)/\1/ p' $config)
tagprefix=$(sed -r -n 's/^tagprefix: *(([-_./a-zA-Z0-9]+ *)+)/\1/ p' $config)
changestemplate="/tmp/XXXX-suse-xsl-version"
changes_header="-------------------------------------------------------------------"
changes_user="[email protected]"

if [[ $1 == '' ]]; then
currentversion=$(sed -r -n 's/^version: *(.+)$/\1/ p' $config)
Expand Down Expand Up @@ -68,9 +71,16 @@ else
fi
echo -n "Open changes file for editing? [y]/n "
read DECISION

if [[ ! $DECISION == 'n' ]] && [[ ! $DECISION == 'no' ]]; then
EDITOR=${EDITOR:-vi}
$EDITOR $changes
TMPFILE=$(mktemp $changestemplate)
TMPFILE2=$(mktemp $changestemplate)
echo -e $changes_header > $TMPFILE
DATE=$(LANG=C TZ=UTC date '+%A %b %d %T %Z %Y' | awk '{$1=substr($1,1,3); print $0}')
echo -e "$DATE - $changes_user\n\n" >> $TMPFILE
${EDITOR:-vi} $TMPFILE
cat $TMPFILE $changes > $TMPFILE2 && mv $TMPFILE2 $changes

else
echo "(kay) Using changes as-is."
fi
Expand All @@ -83,7 +93,10 @@ if [[ ! $DECISION == 'y' ]] && [[ ! $DECISION == 'yes' ]]; then
echo "Rerun this script with --finalize to finish."
exit
else
git commit -m "Set version to $bumpedversion" $files $changes $config
git tag "$tagprefix$bumpedversion"
COMMITMESSAGE="Set version to $bumpedversion"
sed -i '1d' $TMPFILE
git commit -m "$COMMITMESSAGE" $files $changes $config
git tag -a "$tagprefix$bumpedversion" -m "$COMMITMESSAGE"
echo -e "(hey) Do not forget:\n git push && git push $(git remote | head -1) $tagprefix$bumpedversion"
rm $TMPFILE 2>/dev/null || true
fi

0 comments on commit 43e92e3

Please sign in to comment.