Skip to content

Instantly share code, notes, and snippets.

@furdarius
Created September 3, 2018 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save furdarius/d5cba2fba7cef92f7167e68b8d4970d7 to your computer and use it in GitHub Desktop.
Save furdarius/d5cba2fba7cef92f7167e68b8d4970d7 to your computer and use it in GitHub Desktop.
Docker semver tagging bash script
#!/bin/bash
TAG=$1
if [[ $TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "$TAG tag received"
else
echo "Invalid tag format"
exit 1
fi
for i in {1..3}
do
echo "$TAG"
TAG=$(echo $TAG | awk '{gsub(/\.[0-9]+$/,"",$1);print}')
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment