Workflows versus Jobs (opinion)

So I found the thread about filtering workflows… and I assume that isn’t feature complete yet. But I wonder if anyone had an opinion about how to do this in the meantime. Like, should I just make one workflow build-deploy that contains all my jobs, but the jobs are filtered, or seperate workflows, with filtered top-level jobs? I’m thinking the first, b/c then we’ll be set up if filtered workflows becomes a thing.

Something like this:

workflows:
  version: 2
  dev-build-deploy:
    jobs:
      - build_dev
          filters:
            branches:
              only: develop
      - deploy_dev
          requires:
            - build_dev
  staging-build-deploy:
      jobs:
        - build_stage
            filters:
              branches:
                only: staging
        - deploy_stage
            requires:
              - build_stage

I don’t have a view on this, but I’ll post the following just to give you another idea.

If you want to merge things into one job, and then use them more than once, you can use YAML references instead of copying+pasting. I’ve used them in this repo if you want to take a look.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.