CIRCLE_BRANCH variable in for staging branch


#1

Greetings, I want to pass my branch name to the deployment staging section of circle.yml via the CIRCLE_BRANCH variable, but it does not seam to work.

Here is my circle.yml file:

#n#Customize the test machine

machine:

timezone:

America/Los_Angeles # Set the timezone

java:

version: openjdk7

pre:

  • export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home

  • export ANT_HOME=~/workspace/Ant

  • export PATH="$ANT_HOME/bin:$JAVA_HOME/bin/java:$PATH"

Customize deployment commands

deployment:

staging:

branch: $CIRCLE_BRANCH

commands:

 - ./testDeploy.sh

Custom notifications

notify:

webhooks:

# A list of hashes representing hooks. Only the url field is supported.

- url: https://circleci.com/hooks/github

#2

If you are passing in the $CIRCLE_BRANCH for deploy, does that mean you want to deploy all branches?

If so, you can just add a a wildcard to the branch value like: branch: /.*/


#3

That’s exactly what I was looking for. It worked, thanks so much.


#4