Regex matches within YML configuration

Hi there,

Within circle.yml, I use regular expressions to match tag names in the format “v1.2.3”.

deployment:
  production:
    tag: /(v[0-9]\.[0-9]\.[0-9])/
    commands:
      - ./deploy.sh production $tag

I need the deploy.sh script to know what tag is currently matched, but referring to it as $tag doesn’t pass the tag name to the script. Is there a way to do this?

Try CIRCLE_TAG as mentioned here: https://circleci.com/docs/1.0/environment-variables/#build-details

Hopefully that meets your needs. :slight_smile:

Ah, ok, so instead of trying to match the regex I just need to switch between CIRCLE_BRANCH and CIRCLE_TAG.

Thanks for pointing that out to me… looks like I was barking up the wrong tree!

Cheers,
Greg.

Well you still need to regex part if you want the deploy section to trigger based on tags. I’m saying that instead of passing $tag to the deploy script, pass $CIRCLE_TAG.