Created
September 3, 2018 16:03
-
-
Save furdarius/d5cba2fba7cef92f7167e68b8d4970d7 to your computer and use it in GitHub Desktop.
Docker semver tagging bash script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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