Add support for deploying from TravisCI Tag Builds #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Many people prefer to use git tags to trigger builds and deployments. gh-pages-travis doesn't currently support deploying from a TravisCI Tag Build as the environment variables in TravisCI are not set correctly. TravisCI sets the TRAVIS_TAG correctly, but Travis still currently sets TRAVIS_BRANCH to the Tag name, not the git branch name that the tagged commit occurred on. see: TravisCI issue 1675 This means that the comparison between the desired DEPLOY_BRANCH in gh-pages-travis and the TRAVIS_BRANCH always fails on Tag Builds.
The suggested change does the following:
Additionally:
Other noteworthy tidbits:
git branch --contains tags/$TRAVIS_TAG
command is executed, if the tag does not exist on the branch anywhere the output error from git is not particularly helpful. The error returned iserror: malformed object name
, however, this is not necessarily because the TRAVIS_TAG is erroneous, but rather that when the tag name is searched by git it transforms it to the SHA1 abbreviated ID and then attempts to expand that to the fully-qualified SHA1 which outputs this error (see). So if the searched Tag does not exist, this error is shown. This is unlikely to occur since the Tag should always exist on Travis initialisation, but if the tag is removed before the deploy, then it may show itself.