Triggering a job on a commit with tag

I have 3 different jobs:

  1. Runs the tests
  2. Builds and uploads the app to TestFlight
  3. Submits the app to AppStore Review

The following snippet represents the workflow:

workflows:
  test-upload-submit:
    jobs:
      - run-tests:
          filters: &filters-release # this yaml anchor sets filter configs to "filters-release"
            branches:
              only:
                - /release\/.*/

      - run-upload:
          requires:
            - run-tests
          filters:
            <<: *filters-release # calls the previously set yaml anchor.

      - run-submit:
          requires:
            - run-upload
          filters: 
            tags:
              only: 
                - /^v.*/

What I want to achieve: When I create an annotated tag, then push it to GitHub using git push --follow-tags I want CI to run all the jobs. But, when I push changes without tags, it should only upload a built to TestFlight. The problem is, the 3rd job is being triggered even I push without tags. Any help appreciated

Yes, the way I’ve had it explained to me is that the filters section works like an implicit OR between tags and branches, and missing (either one of those) essentially means *.

What I believe you need is for your run-submit job to look like this:

          filters: 
            tags:
              only: 
                - /^v.*/
            branches:
              ignore: /.*/

I had this exact situation today, and adding the branches part was the key for me. Hopefully it is for you too!