Preferred:
X.Y.Z_${CI-buildNo}.${gitcommit}
Ensure our POM accepts versions set externally.
for Now Maven: X.Y.Z , Tag X.Y.Z__${CI-buildNo}.${gitcommit} , Docker label ${CI-buildNo}.${gitcommit}
Script below is what I've used to industrialise moving from a 'master' branch to 'main' both locally and remotely.
Have a local Github authentication token set in environment variable GIT_TOKEN
Assumes you have a repo with more than 1 commit, and a local master
branch tracking a remote master
branch.