I'm trying to setup some kind of versioning pipeline on Github actions. I'm working with a Monorepo with many other project who have their own independent versioning, so I find myself unable to use the releases functionality or pushing my version changes as a commit.
Previously, I worked with Azure pipelines, which have a very useful counter
function whose state is maintained by Azure. It doesn't require committing changes or creating releases, which means I could simply set the version for that specific pipeline with:
npm version <value from azure>
And the value would automatically change on the next Azure run. On top of that, if either major
or minor
values were changed, it would reset the patch
value to 0
and start the counter again.
Can I do anything similar on Github? I know I can use ${{ github.run_number }}
to get the workflow's number, so I can run:
npm version 1.0.${{ github.run_number }}
But I'd like my patch version to start back from zero if either major
or minor
are changed.