sudo: required
dist: trusty

git:
  depth: false

services:
  - docker

env:
  global:
    - REPO=$TRAVIS_REPO_SLUG
    - VERSION=$TRAVIS_TAG
    - CODENAME=livarot
    - GO111MODULE=on

script:
- echo "Skipping tests... (Tests are executed on SemaphoreCI)"
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then travis_retry make docs-pull-images && make docs; fi

before_deploy:
  - >
    if ! [ "$BEFORE_DEPLOY_RUN" ]; then
      export BEFORE_DEPLOY_RUN=1;
      sudo -E apt-get -yq update;
      sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install docker-ce=${DOCKER_VERSION}*;
      docker version;
      echo "${DOCKERHUB_PASSWORD}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin;
      make build-image;
      if [ "$TRAVIS_TAG" ]; then
        make release-packages;
      fi;
    fi

deploy:
  - provider: releases
    api_key: ${GITHUB_TOKEN}
    file: dist/traefik*
    skip_cleanup: true
    file_glob: true
    on:
      repo: traefik/traefik
      tags: true
  - provider: script
    script: sh script/deploy.sh
    skip_cleanup: true
    on:
      repo: traefik/traefik
      tags: true

