Can you specify a tag *and* a branch?

I know I can do something like this to deploy commits in a branch:

    branch: develop
      - npm run build

And according to the docs, you can also build from a tag:

    tag: /production-.*/
      - npm run build

But can you combine the two? I only want to create a new production build on new production-* tags in the master branch. What if both master and develop are at the same commit and I add a tag. In which branch will the build be created? This matters to me, because based on which branch npm run build is run from it creates either a staging or production build.

I’ll change my build script soon to explicitly take a env parameter but for now it’d be good to get this working with the current scripts.


Well I just went ahead and made those changes to my build script, so now I specifically run npm run production for example.

Would still be nice to know if this would’ve been possible though :slight_smile:

This is hard because a tag technically has nothing to do with branches, it’s a pointer to a commit. When using a tag, there can be no branch in a way, or multiple branches if a merge occurred at some point.

Personally I would have the script based everything off the tag. A release tag that follows a certain regex pattern for example would be considered “production”. Unless you’re doing continuous deployment in which case I’d ignore tags and just deploy master or a separate “production” branch.

1 Like