Skip to content

Commit

Permalink
To allow ignoring exit codes, move the before_deploy logic into its o…
Browse files Browse the repository at this point in the history
…wn script
  • Loading branch information
hamishcoleman committed Oct 16, 2019
1 parent 7f81726 commit 76fecbd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ script:
- make test CONFIG_DISABLE_KVM=yes

before_deploy:
- git config --local user.name "Automated Dummy User"
- git config --local user.email "noreply@example.com"
- git remote set-url origin https://${TRAVIS_REPO_SLUG%%/*}:$GITHUB_TOKEN@github.com/$TRAVIS_REPO_SLUG
- test -z "$TRAVIS_TAG" && echo TRAVIS_TAG was not set
- test -z "$TRAVIS_TAG" && git tag --force prerelease
- test -z "$TRAVIS_TAG" && git push --force --tags
- test -z "$TRAVIS_TAG" && export TRAVIS_TAG=prerelease
- ./scripts/travis_before_deploy || export TRAVIS_TAG=prerelease

deploy:
provider: releases
Expand Down
24 changes: 24 additions & 0 deletions scripts/travis_before_deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
#
# I would like every successful build on the master branch to upload the
# generated binaries to a "prerelease" tag on github - thus making the files
# avilable to any interested parties
#
# This requires working around travis-CI

if [ -n "$TRAVIS_TAG" ]; then
echo TRAVIS_TAG is already set, this commit is already tagged
exit 0
fi

git config --local user.name "Automated Dummy User"
git config --local user.email "noreply@example.com"
git remote set-url origin https://${TRAVIS_REPO_SLUG%%/*}:$GITHUB_TOKEN@github.com/$TRAVIS_REPO_SLUG

git tag --force prerelease
git push --force --tags

exit 1

# The travis before_deploy script can detect this exit code:
# - ./scripts/travis_before_deploy || export TRAVIS_TAG=prerelease

0 comments on commit 76fecbd

Please sign in to comment.