sudo: required

services:
  - docker

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

on:
  tags: true

#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

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+\.\d+$/ # 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

Fix tag handling in CI script
Fix tag handling in CI script
