DEV Community

Discussion on: How to change GitHub Actions run_number

Collapse
 
antebios profile image
Richard Nunez

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:

  • name: Install GitVersion uses: gittools/actions/gitversion/setup@v0.9.7 with: versionSpec: '5.5.0'

step 2 - execute:

  • 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.

Read more here: github.com/GitTools/actions

Collapse
 
andreisfedotov profile image
Andrei Fedotov

It looks very interesting, thank you for sharing!