sudo: required            # 超级权限

dist: trusty              # 在ubuntu:trusty

language: go              # 声明构建语言环境

go:                       # 只构建最新版本
  - 1.8

services:                  # docker环境
  - docker

branches:                 # 限定项目分支
  only:
    - /^v[0-9](\.[0-9]){2}(-rc[1-9])?$/

install:
  - curl https://glide.sh/get | sh  # 安装glide包管理

script:
  - glide up
  - GOOS=linux GOARCH=amd64 go build                                    # 编译版本
  - docker build -t registry.cn-hangzhou.aliyuncs.com/deepzz/eiblog .   # 构建镜像

after_success:
  # - if [ "$TRAVIS_BRANCH" =~ ^v[0-9](\.[0-9])+.*$ ]; then
  #   docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" registry.cn-hangzhou.aliyuncs.com;
  #   docker push registry.cn-hangzhou.aliyuncs.com/deepzz/eiblog;
  #   fi
  - docker push registry.cn-hangzhou.aliyuncs.com/deepzz/eiblog

before_deploy:
   - ./dist.sh
     
deploy:
  provider: releases
  api_key:
    secure: AGW05sQuQfjy77+JprSV+ohti/VVgFuh7UOTV0+hwxqsOVXSoIQz/ZPOlHWPP1iiSiGGEalspm+UtKRvADcDfllUaEwo7kebfFeMx4X//qxFxQSQ5LJYx7qxsTDpuQ4CF8zifCtND3ynnUAdx0P6FFkxE/67kN2n4CrhIxYCUb8gNPzDDRuS0ZNBC4zzNldJo/vtatbvc2btuFfwKoClYf+xPLy5luLqDvKF+hdjJ8NuZl8BWkWxXE+kk8fW4iUn2IV0qtLRZ3FQUyAF2CumzxqZfViX+rYTXsfbabYY5nYG6opT4mUEF58T4X3uRV0e3Q6Fe73nmLh9cyAoQl1BTSJ1XiyV4eJJWcKEMY7DqJ646lzoUT449YwvTK57klcfBbShpcjFf2alVdEbr9jbEXrCkuWKnssO9VfufhYF6t9h22c79evpexpIbsoncPD+b+n712MzufREtUF4kpUdkIir5n9CgQl/l7S+fV+n+gME+mcA44K7iPXkC80UfxJiw83QizT39OQhExq6SPIwrbt2vlAkBpSLMUS9iAHtTJYUsmH1SsmrxGK3WromKysWeTRJbcAJls2k6V313sn4TuYBWiHTUfsUBhv+objDFA2TsfO+g0g1JsdfZb5EsKrqNvs/2ta1xlzdE0+/TLG/YNKIOPkHnXswAM3DZm3zEss=
  skip_cleanup: true
  file: "*.tar.gz"
  file_glob: true
  on:
    tags: true
    repo: eiblog/eiblog
    all_branches: true
