A Github Action to automatically bump and tag master, on merge, with the latest SemVer formatted version. Works on any platform.
See the codeA GitHub Action to automatically bump and tag master, on merge, with the latest SemVer formatted version. Works on GitHub Actions runners supporting Node 24.
This README describes v7. See Migrating from v6 to v7 before upgrading.
name: Bump version
on:
push:
branches:
- master
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v7
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub release
if: steps.tag_version.outputs.new_tag != ''
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
prerelease: ${{ steps.tag_version.outputs.prerelease == 'true' }}
contents: write. Usually ${{ secrets.GITHUB_TOKEN }}.true). With false, a full 100-tag page fails explicitly because selecting a version from incomplete results would be unsafe.master or .* or release.*,hotfix.*,master... (default: ^master$,^main$). Expressions match the whole branch name.patch). You can also set false to avoid generating a new tag when none is explicitly provided. Can be patch, minor or major.prerelease). You can also set false to avoid generating a new tag when none is explicitly provided. Can be prerelease, prepatch, preminor or premajor.false).v).<branch>).custom_release_rules (optional) - Comma separated list of release rules.
Format: <keyword>:<release_type>:<changelog_section> where <changelog_section> is optional and will default to Angular's conventions.
Examples:
hotfix:patch,pre-feat:preminor,bug:patch:Bug Fixes,chore:patch:Choresundefined.undefined.v0.0.0 if none). Available with custom_tag too.0.0.0 if none) without the prefix. Available with custom_tag too.major, minor, patch or custom - can be prefixed with pre).Note: This action creates a lightweight tag by default.
The action will parse the new commits since the last tag using the semantic-release conventions.
semantic-release uses the commit messages to determine the type of changes in the codebase. Following formalized conventions for commit messages, semantic-release automatically determines the next semantic version number.
The default parser is conventionalcommits, shared by bump analysis and changelog generation. Both feat!: breaking change and BREAKING CHANGE: footers trigger a major release. Set commit_analyzer_preset: angular for Angular parsing.
Here is an example of the release type that will be done based on a commit messages:
| Commit message | Release type |
| Patch Release |
| Minor Release |
| Major Release |
If eligible commits exist but none selects a bump, default_bump is used. With no eligible commits, no new version is calculated unless custom_tag or a force-bump input is supplied.
packages/web,shared/**. Both old and new paths of renamed files count. Each commit's files are fetched separately. A truncated file list fails instead of silently omitting changes.[no-release],[skip-release]. Set an empty string to disable.* ... or - ... squash-message bullets in addition to the original commit. Default: false. Conventional PR titles remain the recommended default. This does not recover commits removed by squash/rebase or infer missing footers for individual bullets.conventionalcommits (default) or angular. Both presets and their templates ship inside the action; arbitrary installed preset packages are not loaded.{"issuePrefixes":["AB#"],"issueUrlFormat":"https://dev.azure.com/example/project/_workitems/edit/{{id}}"}. This action does not read .releaserc.v1.* for a maintained v1 branch. Without a filter, the highest matching semantic version in the repository is used; branch ancestry is not inferred.v after tag_prefix. With an empty prefix, this separates legacy 1.2.3 tags from v2.0.0 tags. Default: false.major, minor, patch, premajor, preminor, prepatch, prerelease; false disables version creation for that mode. Prefer the pre* types for prereleases.default_prerelease_bump is prerelease. Defaults to default_bump (or patch when that is false).0.0.0. The first release analyzes all history reachable from the target commit.1.2.3.4 to be analyzed as 1.2.3.custom_tag as the target version and append/increment its prerelease identifier, e.g. 2.0.0-rc.0. Default: false.An existing prerelease already includes its version bump: a fix after 1.1.1-rc.0 produces 1.1.1-rc.1. A higher-level change can still advance the base: a feature on a patch RC starts a minor RC; a breaking change starts a major RC. Explicit force-bump inputs override that progression. Identifiers match exactly, so feature never selects feature-extra tags. Empty append_to_pre_release_tag uses the branch name; to produce stable tags, configure release_branches instead.
Custom tags are literal suffixes after tag_prefix. Use tag_prefix: "" to avoid v, or custom_tag for formats such as 1.2, 1.2.3.4, or deployed. Automatic calculation stays SemVer-compliant, including the numerical prerelease counter. To omit that counter, provide your own custom_tag.
custom_tag: deployed with an empty prefix. Default: false.v2 and v2.3. Default: false. These aliases deliberately move; the full version tag is not overwritten unless force_update is also enabled.true. Set false to create the tag only in the local checkout.false. Remote tagging uses the GitHub API and does not otherwise update .git. Annotated local tags require Git identity configuration.owner/repo, default GITHUB_REPOSITORY. The token and selected ref/SHA must belong to or be accessible in that repository. Local operations require its matching checkout.GITHUB_SERVER_URL.commit_sha is supplied. commit_sha takes precedence, then ref, then GITHUB_SHA.false. Earlier successful writes cannot be rolled back; inspect logs before retrying.dry_run: true suppresses all tag writes, including local tags and rolling aliases. PR events never publish remote tags, even when configured as release branches. Unlisted branches and PRs receive versions ending in the first seven characters of the target commit hash.
Concurrent runs targeting the same version stream should be serialized with workflow concurrency. The action retries transient server failures for reads only. If the compare API remains unavailable, it uses a complete local checkout (fetch-depth: 0). It fails if neither source can provide history, rather than guessing a bump.
true or false for the calculated version; suitable for a downstream release action.contents: write when publishing, and check repository tag rules. Fork and Dependabot events may not receive your secrets. Tagging older workflow-changing commits may require additional token permissions; the action cannot grant these.GITHUB_TOKEN; use an appropriately scoped GitHub App/PAT when a separate workflow must run. Keep triggers restricted to branches to avoid loops. The action also ignores tag-triggered runs.feat: ..., fix(scope): ..., or a matching custom rule. Escaped colon types are supported, e.g. \:sparkles\::minor:Features for :sparkles:(web): new UI.if: steps.tag_version.outputs.new_tag != ''; no eligible bump intentionally produces no new tag.commit_sha. GITHUB_SHA remains the original event SHA. Use a dry run to calculate the version and custom_tag to reuse it.create_local_tag: true, push: false, or explicitly fetch the remote tags afterward. Fetching is required if you need the exact remote annotated tag object locally.NO_PROXY are supported by the bundled HTTP client. No runtime npm install is required. Extra corporate CA certificates can be provided through NODE_EXTRA_CA_CERTS.anothrNick/github-tag-action - a similar action using a Dockerfile (hence not working on macOS)
389 followers Β· starred Feb 2021
680 followers Β· starred Aug 2024
362 followers Β· starred Jan 2025
479 followers Β· starred Jun 2024
A Github Action to automatically bump and tag master, on merge, with the latest SemVer formatted version. Works on any platform.
See the codeA GitHub Action to automatically bump and tag master, on merge, with the latest SemVer formatted version. Works on GitHub Actions runners supporting Node 24.
This README describes v7. See Migrating from v6 to v7 before upgrading.
name: Bump version
on:
push:
branches:
- master
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v7
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub release
if: steps.tag_version.outputs.new_tag != ''
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
prerelease: ${{ steps.tag_version.outputs.prerelease == 'true' }}
contents: write. Usually ${{ secrets.GITHUB_TOKEN }}.true). With false, a full 100-tag page fails explicitly because selecting a version from incomplete results would be unsafe.master or .* or release.*,hotfix.*,master... (default: ^master$,^main$). Expressions match the whole branch name.patch). You can also set false to avoid generating a new tag when none is explicitly provided. Can be patch, minor or major.prerelease). You can also set false to avoid generating a new tag when none is explicitly provided. Can be prerelease, prepatch, preminor or premajor.false).v).<branch>).custom_release_rules (optional) - Comma separated list of release rules.
Format: <keyword>:<release_type>:<changelog_section> where <changelog_section> is optional and will default to Angular's conventions.
Examples:
hotfix:patch,pre-feat:preminor,bug:patch:Bug Fixes,chore:patch:Choresundefined.undefined.v0.0.0 if none). Available with custom_tag too.0.0.0 if none) without the prefix. Available with custom_tag too.major, minor, patch or custom - can be prefixed with pre).Note: This action creates a lightweight tag by default.
The action will parse the new commits since the last tag using the semantic-release conventions.
semantic-release uses the commit messages to determine the type of changes in the codebase. Following formalized conventions for commit messages, semantic-release automatically determines the next semantic version number.
The default parser is conventionalcommits, shared by bump analysis and changelog generation. Both feat!: breaking change and BREAKING CHANGE: footers trigger a major release. Set commit_analyzer_preset: angular for Angular parsing.
Here is an example of the release type that will be done based on a commit messages:
| Commit message | Release type |
| Patch Release |
| Minor Release |
| Major Release |
If eligible commits exist but none selects a bump, default_bump is used. With no eligible commits, no new version is calculated unless custom_tag or a force-bump input is supplied.
packages/web,shared/**. Both old and new paths of renamed files count. Each commit's files are fetched separately. A truncated file list fails instead of silently omitting changes.[no-release],[skip-release]. Set an empty string to disable.* ... or - ... squash-message bullets in addition to the original commit. Default: false. Conventional PR titles remain the recommended default. This does not recover commits removed by squash/rebase or infer missing footers for individual bullets.conventionalcommits (default) or angular. Both presets and their templates ship inside the action; arbitrary installed preset packages are not loaded.{"issuePrefixes":["AB#"],"issueUrlFormat":"https://dev.azure.com/example/project/_workitems/edit/{{id}}"}. This action does not read .releaserc.v1.* for a maintained v1 branch. Without a filter, the highest matching semantic version in the repository is used; branch ancestry is not inferred.v after tag_prefix. With an empty prefix, this separates legacy 1.2.3 tags from v2.0.0 tags. Default: false.major, minor, patch, premajor, preminor, prepatch, prerelease; false disables version creation for that mode. Prefer the pre* types for prereleases.default_prerelease_bump is prerelease. Defaults to default_bump (or patch when that is false).0.0.0. The first release analyzes all history reachable from the target commit.1.2.3.4 to be analyzed as 1.2.3.custom_tag as the target version and append/increment its prerelease identifier, e.g. 2.0.0-rc.0. Default: false.An existing prerelease already includes its version bump: a fix after 1.1.1-rc.0 produces 1.1.1-rc.1. A higher-level change can still advance the base: a feature on a patch RC starts a minor RC; a breaking change starts a major RC. Explicit force-bump inputs override that progression. Identifiers match exactly, so feature never selects feature-extra tags. Empty append_to_pre_release_tag uses the branch name; to produce stable tags, configure release_branches instead.
Custom tags are literal suffixes after tag_prefix. Use tag_prefix: "" to avoid v, or custom_tag for formats such as 1.2, 1.2.3.4, or deployed. Automatic calculation stays SemVer-compliant, including the numerical prerelease counter. To omit that counter, provide your own custom_tag.
custom_tag: deployed with an empty prefix. Default: false.v2 and v2.3. Default: false. These aliases deliberately move; the full version tag is not overwritten unless force_update is also enabled.true. Set false to create the tag only in the local checkout.false. Remote tagging uses the GitHub API and does not otherwise update .git. Annotated local tags require Git identity configuration.owner/repo, default GITHUB_REPOSITORY. The token and selected ref/SHA must belong to or be accessible in that repository. Local operations require its matching checkout.GITHUB_SERVER_URL.commit_sha is supplied. commit_sha takes precedence, then ref, then GITHUB_SHA.false. Earlier successful writes cannot be rolled back; inspect logs before retrying.dry_run: true suppresses all tag writes, including local tags and rolling aliases. PR events never publish remote tags, even when configured as release branches. Unlisted branches and PRs receive versions ending in the first seven characters of the target commit hash.
Concurrent runs targeting the same version stream should be serialized with workflow concurrency. The action retries transient server failures for reads only. If the compare API remains unavailable, it uses a complete local checkout (fetch-depth: 0). It fails if neither source can provide history, rather than guessing a bump.
true or false for the calculated version; suitable for a downstream release action.contents: write when publishing, and check repository tag rules. Fork and Dependabot events may not receive your secrets. Tagging older workflow-changing commits may require additional token permissions; the action cannot grant these.GITHUB_TOKEN; use an appropriately scoped GitHub App/PAT when a separate workflow must run. Keep triggers restricted to branches to avoid loops. The action also ignores tag-triggered runs.feat: ..., fix(scope): ..., or a matching custom rule. Escaped colon types are supported, e.g. \:sparkles\::minor:Features for :sparkles:(web): new UI.if: steps.tag_version.outputs.new_tag != ''; no eligible bump intentionally produces no new tag.commit_sha. GITHUB_SHA remains the original event SHA. Use a dry run to calculate the version and custom_tag to reuse it.create_local_tag: true, push: false, or explicitly fetch the remote tags afterward. Fetching is required if you need the exact remote annotated tag object locally.NO_PROXY are supported by the bundled HTTP client. No runtime npm install is required. Extra corporate CA certificates can be provided through NODE_EXTRA_CA_CERTS.anothrNick/github-tag-action - a similar action using a Dockerfile (hence not working on macOS)
389 followers Β· starred Feb 2021
680 followers Β· starred Aug 2024
362 followers Β· starred Jan 2025
479 followers Β· starred Jun 2024