Skip to content
tag

GitHub Action

SemVer Autotag

0.1.0 Latest version

SemVer Autotag

tag

SemVer Autotag

Tags the project (if untagged) generating a valid (and reasonable) Semantic Versioning 2.0 version

Installation

Copy and paste the following snippet into your .yml file.

              

- name: SemVer Autotag

uses: DanySK/semver-autotag-action@0.1.0

Learn more about this action in DanySK/semver-autotag-action

Choose a version

Semantic Versioning Automatic Tag Action

A GitHub Action that generates a SemVer 2.0 compatible tag on untagged repository commits. Requires a complete checkout. This action replicates on GitHub Actions the behavior of the automatic tagging system of Gravis-CI

It produces a tag that can be used to deploy e.g. on GitHub Releases

Usage example

In this example, this action is used to create a GitHub Releases delivery.

name: Build and deploy
on:
  push:

jobs:
  Tag-and-release:
    runs-on: ubuntu-latest
    steps:
      # Checkout the repository
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Fetch tags
        shell: bash
        run: git fetch --tags -f
      - name: Autotag
        uses: DanySK/semver-autotag-action@master
      - name: Deploy
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          TAG=$(git describe --tags --exact-match HEAD)
          hub release create -m "$(git tag -l --format='%(contents)' "$TAG")" "$TAG" || true
          hub release edit -m '' -a a_file "$TAG"