From 92c89b98eec5c3cf7917211a1ae24f9b546b7358 Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Sun, 23 Dec 2018 09:20:10 -0800 Subject: [PATCH] travis: Utilize build stages for deploy --- .travis.yml | 19 ++++++++++++------- etc/travis-deploy.sh | 11 +++++++---- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5b36230..92dc439 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,17 +9,22 @@ addons: env: global: - GO111MODULE=on - - DEPLOY_WITH_MAJOR="1.11" -before_script: +install: - go get golang.org/x/lint/golint - make deps go: - "1.11.x" + - "tip" -deploy: - provider: script - script: etc/travis-deploy.sh - on: - tags: true +jobs: + include: + - stage: deploy + script: etc/travis-deploy.sh + go: "1.11.x" + +stages: + - test + - name: deploy + if: tag IS present diff --git a/etc/travis-deploy.sh b/etc/travis-deploy.sh index e93c363..f605004 100755 --- a/etc/travis-deploy.sh +++ b/etc/travis-deploy.sh @@ -1,10 +1,13 @@ #!/bin/bash # travis-deploy.sh -# description: Trigger goreleaser deployment in correct build scenarios +# description: Trigger goreleaser deployment set -eo pipefail set -x -if [[ "$TRAVIS_GO_VERSION" == "$DEPLOY_WITH_MAJOR."* ]]; then - curl -sL https://git.io/goreleaser | bash -fi +# downloading deps probably added to go.mod and go.sum, goreleaser will fail. +git reset --hard +git clean -dfx + +# build release. +curl -sL https://git.io/goreleaser | bash