Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
desc 'Verify user is on the right branch or tag, since assets are built locally'
task :verify_git_branch do
on roles(:app) do
run_locally do
deployTarget = "#{fetch(:branch)}" # convert to string
currentBranch = ENV['TRAVIS_BRANCH'] \
? ENV['TRAVIS_BRANCH'] \
: capture(:git, 'rev-parse --abbrev-ref HEAD')
currentTag = capture(:git, 'describe --exact-match --tags 2>/dev/null || echo 0')
if ((deployTarget != currentBranch) && (deployTarget != currentTag))
abort "\n" \
"Deploy aborted: incorrect branch ⚠️\n\n" \
"It appears you haven't checked out the branch or tag you're trying to deploy. \n" \
"$ git checkout #{fetch(:branch)} && cap #{fetch(:stage)} deploy\n\n" \
end
end
end
end