Skip to content

anantacloud-actions/github-tag-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Modern GitHub Tag Action 🏷️

image

A lightweight, high-performance GitHub Action to automatically manage Semantic Versioning (SemVer) tags. This action calculates the next version based on your current tags and pushes a new tag to your repository.

Marketplace License: MIT

🚀 Features

  • Automated SemVer: Bumps patch, minor, or major versions automatically.
  • Node 20 Runtime: Built on the latest GitHub Actions runner for speed and security.
  • Lightweight: Compiled into a single distribution file for fast execution.
  • Dry Run Support: Preview your next tag without pushing it.
  • Custom Prefixes: Support for v1.0.0, release-1.0.0, or no prefix at all.

🛠 Usage

To use this action, create a .yml file in your .github/workflows/ directory.

Basic Example

name: Auto Tag
on:
  push:
    branches:
      - main

jobs:
  tag:
    runs-on: ubuntu-latest
    permissions:
      contents: write # Important: Required to create tags
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0 # Required to see existing tags

      - name: Bump version and push tag
        id: tag_action
        uses: anantacloud-actions/github-tag-action@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          default_bump: patch

      - name: Output New Tag
        run: echo "The new tag is ${{ steps.tag_action.outputs.new_tag }}"

⚙️ Configuration

Inputs

Input Description Required Default
github_token GITHUB_TOKEN or Personal Access Token. Yes N/A
default_bump Which part of the version to increment (patch, minor, major). No patch
tag_prefix A prefix to add to the tag (e.g., v). No v
dry_run If true, the action calculates the tag but does not push it. No false

Outputs

Output Description
new_tag The value of the newly created tag (e.g., v1.0.1).
old_tag The value of the previous tag (e.g., v1.0.0).

📦 Developer Setup

If you want to contribute or modify this action:

  1. Clone the repo.
  2. Install dependencies: npm install.
  3. Modify src/index.js.
  4. Build the distribution: npm run build.
  5. Note: The dist/index.js file must be committed for the action to run.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

### Final Step: Why `fetch-depth: 0`?
I added `fetch-depth: 0` to the README example. By default, `actions/checkout` only fetches the latest commit. For your action to correctly find the **previous** tags to determine the next version, it needs the full history (or at least the tags). This is a common pitfall for users of tag actions!

Powered by Ananta Cloud
Building the future of cloud automation and seamless CI/CD workflows.

Ananta Cloud

About

Modern SemVer tagging for GitHub Actions. Robust, fast, and configurable version management with zero external dependencies.

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors