Skip to content

IgorGov/auto-inc-ver

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Auto Increment Version

GitHub License GitHub Latest Release GitHub stars pulls size Doker stars

This action will automatically determine the version for next release by using repository tags. For develop releases: <major>.<patch>-dev<increment> (e.g 2.0-dev0, 2.0-dev1), for stable releases: <major>.<patch> (1.0, 2.0, 2.1).

Action Inputs

  • github_token: Token to get tags from the repo. Pass in using 'secrets.GITHUB_TOKEN'.
  • mode: Mode for next version calculation. Default: 'dev'. Available options:
    • dev: increment the 'dev' version (ignoring commit message) e.g. 1.0-dev1, 1.0-dev2.
    • stable search the commit message for hashtags: #major - for major version (e.g 2.0), #patch - for patch version (e.g 1.1), if no hashtag found fails.
  • suffix: suffix for un stable releases. default: 'dev'.

Action Outputs

  • version: The next release version

Example

  1. Pushing commits to develop branch -> 1.0-dev0 -> 1.0-dev1 -> 1.0-dev2 ...
  2. Releasing an stable release -> commit with '#major' in commit message & push to main branch -> 1.0
  3. Continue development (working on the next release), pushing to develop branch -> 2.0-dev0 -> 2.0-dev1 -> 2.0-dev2 ...
  4. Hot-fix needed (stable release) -> commit with '#patch' in commit message & push to main branch -> 1.1
  5. Continue pushing to develop branch -> 2.0-dev0 -> 2.0-dev1 -> 2.0-dev2 ...

Usage

- name: Auto Increment Version
    uses: docker://igorgov/auto-inc-ver:v1.2.0
    id: versioning
    with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        mode: stable

- name: Print next release version
    shell: bash
    run: |
        echo "${{ steps.versioning.outputs.version }}"