Trying to get deploy on version tags and build on everything else


#1

I’m trying to deploy only tags and build everything else and I can’t get the logic behind it. Can someone give me a tip?

workflows:
  version: 2
  test_build_deploy:
    jobs:
      - build:
          filters:
            tags:
              ignore: /.*/
      - deployment:
          requires:
            - build
          filters:
            tags:
              only: /.*stage$/, /.*/

#3

Here is an example that maybe will clarify :slight_smile:

workflows:
  version: 2
  test-and-staging:
    jobs:
      - test:
          filters:
            tags:
              ignore: /.*/
      - staging:
          requires:
            - test
          filters:
            branches:
              only: master
            tags:
              ignore: /.*/
  release:
    jobs:
      - archive:
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /^v.+/

What the code is doing is triggering a a build with a release workflow associated with it ONLY if the tag name starts with v (e.g v1, v10, v35, and so on…)


#4