Semantic version generator

Docker image build. GitHub release (latest by date) codecov

Project created overnight, to prove that management of semantic versioning is NOT painful and do not require arguments and debates within the team. Simple, clean and only thing the project team should need to agree to are the keywords.

How does it work

  • Binary clones the github repository
  • Iterates through the list of commits looking for the keywords specified in config file for additional bumps of versions
  • Returns the semantic version which can be included in the release



If you intend to use this project with remote repositories ( regardless of them being private or public ) you need to authenticate with your repository. To do so you can utilise the following environment variables ( they are NOT github specific, for other providers you can use the password )

export GITHUB_USERNAME=lukaszraczylo
export GITHUB_TOKEN=yourPersonalApiToken

As a binary

You can download latest versions of the binaries from the release page.

Supported OS and architectures: Darwin ARM64/AMD64, Linux ARM64/AMD64, Windows AMD64

bash$ ./semver-gen generate -r
SEMVER 9.0.10
bash$ ./semver-gen generate -l
SEMVER 5.1.1

Local repository flag -l will always take precedence over remote repository URL

  semver-gen generate [flags]
  semver-gen [command]

Available Commands:
  generate    Generates semantic version
  help        Help about any command

  -c, --config string       Path to config file (default "semver.yaml")
  -d, --debug               Enable debug mode
  -h, --help                help for semver-gen
  -l, --local               Use local repository
  -r, --repository string   Remote repository URL. (default "")
  -s, --strict              Strict matching
  -u, --update              Update binary with latest
  -v, --version             Display version

As a github action

    name: Preparing build context
    runs-on: ubuntu-latest
      RELEASE_VERSION: ${{ steps.semver.outputs.semantic_version }}
      - name: Checkout repo
        uses: actions/[email protected]
          fetch-depth: '0'
      - name: Semver run
        id: semver
        uses: lukaszraczylo/[email protected]_LATEST_TAG_HERE
        # you can also use v1 tag which _should_ automatically upgrade to latest
        # uses: lukaszraczylo/[email protected]
          config_file: semver.yaml
          # either...
          repository_local: true
          # or...
          # when using remote repository, especially with private one:
          github_username: lukaszraczylo
          github_token: MySupeRSecr3tPa$$w0rd
      - name: Semver check
        run: |
          echo "Semantic version detected: ${{ steps.semver.outputs.semantic_version }}"

As a docker container

docker pull

Docker supported architectures: Linux/arm64, Linux/amd64

Calculations example [standard]

  • 0.0.1 – PATCH – starting commit
  • 0.0.2 – PATCH – another commit
  • 0.0.4 – PATCH – another commit with word ‘Update’ => DOUBLE increment PATCH
  • 0.1.0 – MINOR – after commit with word ‘Change’ => increment MINOR, reset PATCH
  • 0.1.1 – PATCH – additional commit
  • 1.0.1 – MAJOR – commit with word ‘BREAKING’ = > INCREMENT MAJOR, reset MINOR
  • 1.0.2 – PATCH – another commit

Calculations example [strict matching]

  • 0.0.1 – PATCH – starting commit
  • 0.0.1 – PATCH – another commit
  • 0.0.1 – PATCH – another commit with word ‘Update’ => SINGLE increment PATCH
  • 0.1.0 – MINOR – after commit with word ‘Change’ => increment MINOR, reset PATCH
  • 0.1.0 – PATCH – additional commit
  • 1.0.0 – MAJOR – commit with word ‘BREAKING’ = > INCREMENT MAJOR, reset MINOR
  • 1.0.0 – PATCH – another commit

Example configuration

version: 1
  major: 1
  minor: 0
  patch: 1
  commit: 69fbe2df696f40281b9104ff073d26186cde1024
    - update
    - initial
    - add
    - change
    - improve
    - breaking
    - the # For testing purposes
  • version: is not respected at the moment, introduced for potential backwards compatibility in future
  • force: sets the “starting” version, you don’t need to specify this section as the default is always 0
  • force.commit: allows you to set commit hash from which the calculations should start
  • wording: words the program should look for in the git commits to increment (patch|minor|major)

Good to know

  • Word matching uses fuzzy search AND is case INSENSITIVE
  • I do not recommend using common words ( like “the” from the example configuration )