From d133bcdae7230f980f7188eb205fe99873e0d1da Mon Sep 17 00:00:00 2001 From: Aleks Volochnev Date: Mon, 30 Mar 2020 12:07:35 +0200 Subject: [PATCH] CD Improvement To push the latest tag as a docker image tagged like: - Exact tag, f.e. `:3.0.3` - Latest tag, `:latest` - Latest minor release, f.e. `:3.0` - Latest major release, f.e. `:3` --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4005be3..e9c85a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,9 @@ after_success: - docker tag ${TRAVIS_COMMIT} killrvideo/killrvideo-generator:${TRAVIS_TAG} - docker login -u $DOCKER_USER -p $DOCKER_PASS - docker push killrvideo/killrvideo-generator:${TRAVIS_TAG} +- "[ \"$(git tag --sort=-v:refname | grep -P \"^\\d+.\\d+.\\d+$\" | head -n1)\" == \"$TRAVIS_TAG\" ] && { docker tag ${TRAVIS_COMMIT} killrvideo/killrvideo-generator:latest; docker push killrvideo/killrvideo-generator:latest; }" +- "[ \"$(git tag --sort=-v:refname | grep -P \"^\\d+.\\d+.\\d+$\" | head -n1)\" == \"$TRAVIS_TAG\" ] && { docker tag ${TRAVIS_COMMIT} killrvideo/killrvideo-generator:$(echo $TRAVIS_TAG | cut -d'.' -f 1); docker push killrvideo/killrvideo-generator:$(echo $TRAVIS_TAG | cut -d'.' -f 1); }" +- "[ \"$(git tag --sort=-v:refname | grep -P \"^\\d+.\\d+.\\d+$\" | head -n1)\" == \"$TRAVIS_TAG\" ] && { docker tag ${TRAVIS_COMMIT} killrvideo/killrvideo-generator:$(echo $TRAVIS_TAG | cut -d'.' -f 1).$(echo $TRAVIS_TAG | cut -d'.' -f 2); docker push killrvideo/killrvideo-generator:$(echo $TRAVIS_TAG | cut -d'.' -f 1).$(echo $TRAVIS_TAG | cut -d'.' -f 2); }" # Sudo required for doing docker build sudo: required