Filtering on Tags and Branches creates duplicate jobs

workflow
2.0

#1

I have a case where I want to use the Branch and the version Tag to target specific deployment environments.
The issue is that if include specific branches I end up with 2 build jobs one for each filter.
So from my config I get.

BUT if I filter the branch build then the CIRCLE_BRANCH is empty, and the workflow doesn’t appear under workflows, because that likely selects by the branch.

2 web-app steps and 2 api-server, one targeting the branch and the other targeting the tag.

It would seem that the correct thing to do would be not to create duplicate jobs but rather flatten the branch and tag job into a single step.

workflow config as follows.

workflows:
  version: 2
  un-tagged-build:
    jobs:
      - api-server:
          filters:
            tags:
              ignore: /^v.*/
            branches:
              ignore: 
                - qa
                - master
                - demo
      - web-app:
          filters:
            tags:
              ignore: /^v.*/
            branches:
              ignore: 
                - qa
                - master
                - demo
  tagged-build:
    jobs:
      - api-server:
          filters:
            branches:
              only: 
                - qa
                - master
                - demo
              # ignore: /.*/  # ignore all branch build triggers
            tags:
              only: /^v.*/  # Only build when triggered by a version
      - web-app:
          filters:
            branches:
              only: 
                - qa
                - master
                - demo
              # ignore: /.*/
            tags:
              only: /^v.*/
      - gcp-build-and-submit:
          requires:
            - api-server
            - web-app
          filters:
            branches:
              only: 
                - qa
                - master
                - demo
            tags:
              only: /^v.*/
      - gcp-update-green-blue:
          requires:
            - gcp-build-and-submit
          filters:
            branches:
              only: 
                - demo
            tags:
              only: /^v.*/