Be smarter about tag creation

This commit is contained in:
Nico Schottelius 2022-02-20 21:48:08 +01:00
parent 7707f440ee
commit 838f4c4c73
1 changed files with 11 additions and 2 deletions

View File

@ -6,8 +6,17 @@ docker build -t ungleich-hardware .
while [ $# -ge 1 ]; do
tag=$1; shift
git tag -a -m "Version $tag" $tag
git push --tags
# Does the tag exist?
if git rev-list "$tag" 2>/dev/null; then
cur=$(git describe)
if [ $cur != $tag ]; then
echo "Requested build for $tag, but we are on $cur, aborting"
exit 1
fi
else
git tag -a -m "Version $tag" $tag
git push --tags
fi
docker tag ungleich-hardware:latest ungleich/ungleich-hardware:${tag}
docker tag ungleich-hardware:latest harbor.ungleich.svc.p10.k8s.ooo/ungleich-public/ungleich-hardware:${tag}
docker push ungleich/ungleich-hardware:${tag}