When do you start splitting steps in to different jobs? Trying to understand when I should start moving tasks/steps in to fresh new jobs, versus keeping everything in one large job with lots of steps.
There may not be a fixed answer. It depends on how you use your workflows.
For example, you have a workflow can run on push event, and you want this workflow can like as this:
- when you push to a branch, the workflow only run the steps for building the code.
- when you push to a new tag, the workflow run the steps for build, and then run the steps for release.
In this situation, if you set all the steps (build and release) in a single job, this may be not good, and you need to set the same step level if conditional (jobs.<job_id>.steps.if) on each step for the release so that these step can be skipped when you push to branch. This may also cause the job to be cumbrous and confusion between the steps.
So the best way is setup two jobs, one for build and another for release, and only set a job level if conditional on the release job (jobs.<job_id>.if).
The above example just is one of the many situations. In some situations, you may need to set all the steps in a single job. And in some other situations, you may need to setup several jobs for different processes.