Git Product home page Git Product logo

compute-tag's Introduction

compute-tag

Latest Release Example Runs

A Github action to compute the next version tag.

This can be helpful to automatically compute tags and pipe them to the create-release action.

Inputs

Parameter Description Required Default
github_token A Github token, usually ${{ github.token }}. Y N/A
tag The tag to compute the next version of. If not specified, the most recent tag in the repo. N Latest
branch The branch to find compute the tag for. This requires iteration of all tags for the repo and the commits for the branch to find a tag for a commit on the branch. For large repositories this can be very slow. It is highly recommended that github_token be supplied to prevent rate limit errors when searching. N N/A
version_scheme One of (continuous, semantic). N semantic
version_type One of (major, minor, patch, premajor, preminor, prepatch, prerelease). N prerelease
prerelease_suffix The suffix added to a prerelease tag, if none already exists. N beta
tag_fetch_depth The number of tags to fetch when searching for the previous tag. N 10

Output

  • next_tag The computed next tag.
  • previous_tag The tag used to compute next_tag.

Usage

steps:
  - id: compute_tag
    uses: craig-day/compute-tag@v15
    with:
      github_token: ${{ github.token }}

Examples

For an exhuastive list of every version_scheme+version_type combination, see the results from the Example Runs workflow

Tag each push to master as a semantic prerelease

name: Release

on:
  push:
    branches:
      - master

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - id: compute_tag
        uses: craig-day/compute-tag@v15
        with:
          github_token: ${{ github.token }}

Sample Logs:

Computing the next tag based on: v5.0.0-pre.4
Computed the next tag as: v5.0.0-pre.5

Tag each push to master as a semantic patch

name: Release

on:
  push:
    branches:
      - master

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - id: compute_tag
        uses: craig-day/compute-tag@v15
        with:
          github_token: ${{ github.token }}
          version_type: patch

Sample Logs:

Computing the next tag based on: v5.0.3
Computed the next tag as: v5.0.4

Tag each push to master as a continuous prerelease

name: Release

on:
  push:
    branches:
      - master

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - id: compute_tag
        uses: craig-day/compute-tag@v15
        with:
          github_token: ${{ github.token }}
          version_scheme: continuous
          version_type: prerelease

Sample Logs:

Computing the next tag based on: v5-pre.4
Computed the next tag as: v5-pre.5

Switching from continuous to semantic

name: Release

on:
  push:
    branches:
      - master

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - id: compute_tag
        uses: craig-day/compute-tag@v15
        with:
          github_token: ${{ github.token }}
          version_scheme: semantic

Sample Logs:

Computing the next tag based on: v5-pre.4
Computed the next tag as: v5.0.0-pre.5

Create a GitHub Release for each push to master

NOTE: Since actions/create-release is deprecated, this example uses softprops/action-gh-release which maintains a similar API and feature set.

name: Release

on:
  push:
    branches:
      - master

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - id: compute_tag
        uses: craig-day/compute-tag@v15
        with:
          github_token: ${{ github.token }}
          version_scheme: semantic

      - name: create release
        uses: softprops/action-gh-release@v1
        with:
          name: ${{ steps.compute_tag.outputs.next_tag }}
          tag_name: ${{ steps.compute_tag.outputs.next_tag }}
          generate_release_notes: true
          prerelease: true
        env:
          GITHUB_TOKEN: ${{ github.token }}

compute-tag's People

Contributors

craig-day avatar clong- avatar frederick888 avatar dependabot[bot] avatar rbury avatar alexpls avatar mirrec 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.