Viostream / github-tag-action

A Github Action to tag a repo on merge.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

github-tag-action

A Github Action to automatically bump and tag main, on merge, with the latest SemVer formatted version.

Build Status Stable Version Latest Release

Viostream customisations

This action is based on anothrNick/github-tag-action, but with Viostream defaults applied to simplify our build flow.

Usage

name: Bump version
on:
  push:
    branches:
      - main
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: '0'
    - name: Bump version and push tag
      uses: Viostream/github-tag-action@v2
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

NOTE: set the fetch-depth for actions/checkout@v2 to be sure you retrieve all commits to look for the semver commit message.

Options

Environment Variables

  • GITHUB_TOKEN (required) - Required for permission to tag the repo.
  • DEFAULT_BUMP (optional) - Which type of bump to use when none explicitly provided (default: patch).
  • WITH_V (optional) - Set to false to not tag version with v character.
  • RELEASE_BRANCHES (optional) - Comma separated list of branches (bash reg exp accepted) that will generate the release tags. Other branches and pull-requests generate versions postfixed with the commit hash and do not generate any tag. Examples: main or .* or release.*,hotfix.*,main.
  • CUSTOM_TAG (optional) - Set a custom tag, useful when generating tag based on f.ex FROM image in a docker image. Setting this tag will invalidate any other settings!
  • SOURCE (optional) - Operate on a relative path under $GITHUB_WORKSPACE.
  • DRY_RUN (optional) - Determine the next version without tagging the branch. The workflow can use the outputs new_tag and tag in subsequent steps. Possible values are true and false (default).
  • INITIAL_VERSION (optional) - Set initial version before bump. Default 0.0.0.

Outputs

  • new_tag - The value of the newly created tag.
  • tag - The value of the latest tag after running this action.
  • part - The part of version which was bumped.

Bumping

Manual Bumping: Any commit message that includes #major, #minor, or #patch will trigger the respective version bump. If two or more are present, the highest-ranking one will take precedence.

Automatic Bumping: If no #major, #minor or #patch tag is contained in the commit messages, it will bump whichever DEFAULT_BUMP is set to (which is patch by default). Disable this by setting DEFAULT_BUMP to none.

Note: This action will not bump the tag if the HEAD commit has already been tagged.

Credits

About

A Github Action to tag a repo on merge.

License:MIT License


Languages

Language:Shell 95.9%Language:Dockerfile 4.1%