Forgejo Action to create a semver tag since the latest tag based on conventional commits.
  • TypeScript 100%
Find a file
Jonas Claes 9945376a0f
All checks were successful
Test / test (push) Successful in 9s
chore: remove main.js
2026-05-07 21:10:44 +02:00
.forgejo/workflows feat: add dry_run input to skip tag creation 2026-05-07 20:32:56 +02:00
.vscode chore: add VSCode settings for automatic formatting on save 2026-05-07 20:25:21 +02:00
dist chore: remove main.js 2026-05-07 21:10:44 +02:00
src feat: add dry_run input to skip tag creation 2026-05-07 20:32:56 +02:00
.gitignore Initial commit 2026-05-04 17:26:54 +00:00
action.yml fix: update main entry in package.json to use CommonJS format 2026-05-07 21:09:12 +02:00
LICENSE Initial commit 2026-05-04 17:26:54 +00:00
package.json fix: update main entry in package.json to use CommonJS format 2026-05-07 21:09:12 +02:00
pnpm-lock.yaml feat: bundle packages in output 2026-05-07 21:05:44 +02:00
README.md feat: add dry_run input to skip tag creation 2026-05-07 20:32:56 +02:00
tsconfig.json chore: update workflow to include build step and add TypeScript configuration 2026-05-04 19:40:34 +02:00

create-semver-tag

A Forgejo/GitHub Action that inspects commits since the last tag, determines whether a SemVer bump is required using the Conventional Commits standard, and creates and pushes the new tag automatically.

How it works

  1. Finds the most recent tag that matches the configured prefix (e.g. v*).

  2. Collects every commit between that tag and HEAD (or all commits when no tag exists yet).

  3. Classifies each commit message and picks the highest required bump:

    Commit pattern Bump
    BREAKING CHANGE: footer, or type!: major
    feat: minor
    fix:, perf:, revert: patch
    Anything else (chore:, docs:, …) (none)
  4. If a bump is required, creates the new tag locally and pushes it to origin.

Usage

Forgejo

- uses: jonasclaes/create-semver-tag@v1

GitHub Actions

- uses: jonasclaes/create-semver-tag@v1
  with:
    token: ${{ secrets.GITHUB_TOKEN }}

Note: actions/checkout must run with fetch-depth: 0 so that the full tag history is available.

steps:
  - uses: actions/checkout@v4
    with:
      fetch-depth: 0

  - uses: jonasclaes/create-semver-tag@v1

Inputs

Input Description Default
token Token used to push the new tag. forgejo.token || github.token
tag_prefix Prefix prepended to every version tag. v
initial_version Version to use when no previous tag exists. 0.1.0
default_bump Minimum bump when commits don't mandate one. major | minor | patch | none none
dry_run When true, determines the bump and sets outputs but does not create or push a tag. false

Outputs

Output Description
tag The newly created tag (e.g. v1.3.0). Empty when no bump was needed.
previous_tag The tag that existed before the bump. Empty when there was no previous tag.
type The bump type applied: major, minor, or patch. Empty when no bump was needed.

Advanced usage

Using the outputs in subsequent steps

- uses: jonasclaes/create-semver-tag@v1
  id: semver

- if: steps.semver.outputs.tag != ''
  run: echo "Released ${{ steps.semver.outputs.tag }} (was ${{ steps.semver.outputs.previous_tag }}, bump type: ${{ steps.semver.outputs.type }})"

Always bump at least patch

- uses: jonasclaes/create-semver-tag@v1
  with:
    default_bump: patch

Custom tag prefix

- uses: jonasclaes/create-semver-tag@v1
  with:
    tag_prefix: "release-"   # produces e.g. release-1.2.3

Start from a specific version on first release

- uses: jonasclaes/create-semver-tag@v1
  with:
    initial_version: "1.0.0"  # first tag will be v1.0.0 (or v1.1.0 / v2.0.0 depending on commits)

License

Apache 2.0