sudo: required

services:
  - docker

env:
  # IMPORTANT! Add your docker slug here (commit once)
  - DOCKER_REPO_SLUG=guglielmino/mosquitto-pushetta-auth-plugin
install: []

branches:
  only:
    - master
    - /v\d+\.\d+[a-z]/ # Tag in the format vX.Y.Z

script:
  - if [ ! -z "$TRAVIS_TAG" ]; then export IMAGE_TAG=$TRAVIS_TAG; else export IMAGE_TAG=$TRAVIS_BRANCH; fi
  - docker build -t $DOCKER_REPO_SLUG:latest -t $DOCKER_REPO_SLUG:$IMAGE_TAG .
deploy:
  provider: script
  script: bash docker_push $TRAVIS_TAG
  on:
    tags: true
    condition: '$TRAVIS_TAG =~ ^v[0-9].[0-9].[0-9]$'

sudo: required

services:
  - docker

env:
  # IMPORTANT! Add your docker slug here (commit once)
  - DOCKER_REPO_SLUG=guglielmino/mosquitto-pushetta-auth-plugin
install: []

branches:
  only:
    - master
    - /v\d+\.\d+[a-z]/ # Tag in the format vX.Y.Z

script:
  - echo "TRAVIS_TAG" $TRAVIS_TAG
  - echo "TRAVIS_BRANCH" $TRAVIS_BRANCH
  - if [ ! -z "$TRAVIS_TAG" ]; then export IMAGE_TAG=$TRAVIS_TAG; else export IMAGE_TAG=$TRAVIS_BRANCH; fi
  - docker build -t $DOCKER_REPO_SLUG:latest -t $DOCKER_REPO_SLUG:$IMAGE_TAG .
deploy:
  provider: script
  script: bash docker_push $TRAVIS_TAG
  on:
    tags: true
    condition: '$TRAVIS_TAG =~ ^v[0-9].[0-9].[0-9]$'

Add test for CI trigger on tag
Add test for CI trigger on tag
