Add v prefix to semver image tags

This adds some context e.g. `v1` instead of just `1`, and matches
what some nearby projects use, such as the kpt container functions [0].

[0]: https://github.com/GoogleContainerTools/kpt/issues/1358

Change-Id: I2026fba873a0f074233e7628de35e53f1f880027
Signed-off-by: Sean Eagan <seaneagan1@gmail.com>
This commit is contained in:
Sean Eagan 2021-03-16 15:29:37 -05:00
parent b4ffab50f9
commit f1e42b8444

View File

@ -46,12 +46,12 @@ jobs:
fi
if [[ "$TAG" =~ ^($TAG_PREFIX)?v?(([0-9]+)\.([0-9]+)\.([0-9]+)(-[a-zA-Z]+(\.[0-9]+)?)?)$ ]]
then
TAGS="${BASH_REMATCH[2]}"
TAGS="v${BASH_REMATCH[2]}"
# Prereleases don't count as major and minor
if [[ -z ${BASH_REMATCH[6]} ]]
then
MINOR_TAG="${BASH_REMATCH[3]}.${BASH_REMATCH[4]}"
MAJOR_TAG="${BASH_REMATCH[3]}"
MINOR_TAG="v${BASH_REMATCH[3]}.${BASH_REMATCH[4]}"
MAJOR_TAG="v${BASH_REMATCH[3]}"
TAGS="$TAGS $MINOR_TAG $MAJOR_TAG"
fi
echo ::set-output name=IMG::$IMG