Skip to content

A Github Action to bump and tag the release branch.

License

Notifications You must be signed in to change notification settings

aviral-nayya/github-tag-action

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Tag Action

A Github Action to automatically bump and tag the branch passed by env variable and update latest tag to point to the latest commit based on the passed in bump type.

Usage

name: bump and tag branch
on:
  push:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Bump version and push tag
      uses: Instrument/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        BRANCH: master
        BUMP: major

Note: This workflow should be on a push or merge.

Options

Environment Variables

  • GITHUB_TOKEN (required) - Required for permission to tag the repo.
  • BRANCH (required) - Branch name.
  • BUMP (optional) - Branch name. Defaults to minor.
  • WITH_V (optional) - Tag version with v character. Defaults to true.

Outputs

  • new_tag - The value of the newly created tag.

Note: This action creates an annotated tag.

Semantic Versioning

Versioning will follow https://semver.org/:

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes, MINOR version when you add functionality in a backwards compatible manner, and PATCH version when you make backwards compatible bug fixes. Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

Bumping

With every commit to master latest tag is updated to the latest commit in the master branch.

It will also bump the tag with the DEFAULT_BUMP increment, but it will not bump the tag if the HEAD commit has already been tagged.

Workflow

  • Add this action to your repo
  • Commit some changes
  • Decide what branch you want to compare, example is master.
  • Either push to master or open a PR
  • On push (or merge) to master, the action will:
    • Get latest tag (different than latest)
    • Bump the tag if the HEAD commit has not been tagged
    • Updates latest tag to point to the latest commit on the master branch
    • Pushes tags updates to github

Credits

Forked from: kimgault/github-tag-action

About

A Github Action to bump and tag the release branch.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 94.4%
  • Dockerfile 5.6%