Parallelize steps that depens on another step

I have the following steps (single workflow) to deploy my services:

  1. check what packages have changed
  2. updating the version only of the changed packages (this execute a commit and a push to te repo)
  3. build the changed packages that are libs
  4. push the libs to the registry
  5. build the other packages
  6. deploy the packages

Each package in step 5 and 6 can be run in parallel but the gating of which job is dependant in step no.1

Lets say that I have 4 packages:

 - common (library)
 - database (library
 - server (depends on common and database)
 - frontend (depends on common)

common and database are build and pushed to the repository (NPM)
The server can be built in parallel with frontend once common and database are published.

My idea is to create a JOB for step #1, another for step #2, #3, and #4.
At this point I have to gate the different jobs that build the varisous packages and deploy them.

I now have two question

  • How can I get the new git ref for the additional jobs (post commit)?
    I cannot trigger another workflow b3ecaouse i would lose the information gathered in step #1
  • How can I gate the jobs based on step #1?

I suppose that I can do this by using the job outputs variable as specified by:

If I’m doing something completly wrong and there is a better way please let me know.