Giter Site home page Giter Site logo

github-tag-action's Introduction

github-tag-action

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

Build Status Stable Version Latest Release

Medium Post: Creating A Github Action to Tag Commits

Usage

name: Bump version
on:
  push:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
      with:
        fetch-depth: '0'
    - name: Bump version and push tag
      uses: anothrNick/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        WITH_V: true

NOTE: set the fetch-depth for actions/checkout@master 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: minor).
  • WITH_V (optional) - 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: master or .* or release.*,hotfix.*,master ...
  • 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 set!
  • 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.

Note: This action creates a lightweight tag.

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 minor 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.

Workflow

  • Add this action to your repo
  • Commit some changes
  • Either push to master or open a PR
  • On push (or merge) to master, the action will:
    • Get latest tag
    • Bump tag with minor version unless any commit message contains #major or #patch
    • Pushes tag to github

Credits

fsaintjacques/semver-tool

Projects using github-tag-action

A list of projects using github-tag-action for reference.

  • another/github-tag-action (uses itself to create tags)

  • anothrNick/json-tree-service

    Access JSON structure with HTTP path parameters as keys/indices to the JSON.

github-tag-action's People

Contributors

anothrnick avatar peerxu avatar reececomo avatar andrewcole avatar phish108 avatar dmerrick avatar endrjuskr avatar lovromazgon avatar sjauld avatar imdanielsp avatar fabricepipart avatar pavyarov avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.