Why not just use the GitVersion action? It produces the same Semantic versioning that you are looking for, but this time it uses your git history and tags to produce a versioning system. You want a new major version? Just create a git tag. You did a commit on a dev branch? It's automatically a pre-release. You want to make it an official release? Just tag it. And let your CI/CD pipeline do the rest.
name: Run GitVersion
uses: gittools/actions/gitversion/execute@v0.9.13
with:
useConfigFile: true
configFilePath: GitVersion.yml
Notice that I declared a GitVersion.yml file at the base of my repo with the following one line content: "mode: ContinuousDeployment". This config file is optional. It will produce MANY variables that you can use throughout your pipeline process across multiple jobs.
Why not just use the GitVersion action? It produces the same Semantic versioning that you are looking for, but this time it uses your git history and tags to produce a versioning system. You want a new major version? Just create a git tag. You did a commit on a dev branch? It's automatically a pre-release. You want to make it an official release? Just tag it. And let your CI/CD pipeline do the rest.
step 1 - setup:
step 2 - execute:
Notice that I declared a GitVersion.yml file at the base of my repo with the following one line content: "mode: ContinuousDeployment". This config file is optional. It will produce MANY variables that you can use throughout your pipeline process across multiple jobs.
Read more here: github.com/GitTools/actions
It looks very interesting, thank you for sharing!