GitHub Action to automate semantic versioning with labels 🏷️
Add a major, minor, or patch label to a pull request and Verselicious will bump the version, create a git tag, and publish a GitHub release when the PR is merged.
# .github/workflows/release.yml
name: Release
on:
push:
branches: [main]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: hopeman15/verselicious@v0.1.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}That's it. Label your PR with major, minor, or patch, merge it, and a release will be created automatically. The action detects the associated pull request from the merge commit automatically.
- Detects the pull request associated with the push commit
- Reads the labels on that pull request
- Determines the bump type (
major,minor, orpatch) - Finds the latest semver tag in the repository (defaults to
0.0.0if none exist) - Bumps the version accordingly
- Creates a GitHub release with the new tag and auto-generated release notes
If no pull request is found or no versioning label is present, the action logs a message and exits without creating a release.
| Input | Description | Required | Default |
|---|---|---|---|
github_token |
GitHub token for API access. Use a PAT if tag creation needs to trigger downstream workflows. | Yes | — |
major_label |
Label name that triggers a major version bump. | No | major |
minor_label |
Label name that triggers a minor version bump. | No | minor |
patch_label |
Label name that triggers a patch version bump. | No | patch |
tag_prefix |
Prefix for version tags (e.g., v to produce v1.0.0). |
No | "" |
target_branch |
Branch to target for the release. | No | main |
generate_notes |
Whether to auto-generate release notes. | No | true |
| Output | Description | Example |
|---|---|---|
new-version |
The new version after bumping. | 1.1.0 |
previous-version |
The version before bumping. | 1.0.0 |
tag |
The full tag that was created. | v1.1.0 |
release-url |
URL of the created GitHub release. | https://github.com/…/releases/tag/v1.1.0 |
- uses: hopeman15/verselicious@v0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: 'v'This produces tags like v1.0.0, v1.1.0, etc.
- uses: hopeman15/verselicious@v0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
major_label: 'release: major'
minor_label: 'release: minor'
patch_label: 'release: patch'- uses: hopeman15/verselicious@v0
id: version
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- run: echo "Released ${{ steps.version.outputs.tag }}"The default GITHUB_TOKEN does not trigger other workflows when creating tags. If you need tag creation to kick off a downstream workflow (e.g., a publish pipeline), use a Personal Access Token (PAT) instead:
- uses: hopeman15/verselicious@v0
with:
github_token: ${{ secrets.PAT }}