A commit in one job not available in another job in same pipeline


In my release pipeline their are 4 jobs -

  1. derive_version - gets new version number for project depending on commits
  2. commit_version - update the podspec file with above version number and commit the changes
  3. create_release - create new release using release-cli of gitlab
  4. create_artefacts - creates artefacts using updated podspec file

The issue is even if I commit the version number in commit_version job the create_release job gets the old podspec file and so it uses old version number to create reelase artefacts.
One way to solve this is to have 2 pipelines

  1. with derive_verison and commit_version job
  2. with create_release and create_artefacts job

But I want to do this in same pipeline. How can I do this in same pipeline ?