Skip to content

GitHub Action

Versu GitHub Action automates versioning in your CI/CD pipeline.

Basic Usage

Add to your GitHub Actions workflow:

yaml
- uses: versuhq/versu@v3

Inputs

InputDescriptionRequiredDefault
prerelease-modeEnable prerelease mode for generating pre-release versions.Nofalse
prerelease-idCustom identifier for pre-release versions (e.g., alpha, beta).Noalpha
bump-unchangedBump version even if there are no changes since the last release.Nofalse
add-build-metadataAdd build metadata to the version (e.g., 1.0.0+build.123).Nofalse
timestamp-versionsUse timestamp-based pre-release identifiers (e.g., 1.1.0-alpha.20240101.1234.0). Requires prerelease-mode.Nofalse
append-snapshotAppend -SNAPSHOT to the version (e.g., 1.0.0-SNAPSHOT).Nofalse
create-tagsAutomatically create Git tags for the new version.Notrue
generate-changelogGenerate a changelog based on commits since the last version.Notrue
generate-release-notesGenerate release notes summarizing all changes.Notrue
push-changesPush version changes and tags to the remote repository.Notrue
dry-runRun the action without making any changes (for testing).Nofalse
commit-release-notesWhether to commit generated release notes.Nofalse
adapterSpecify a custom adapter for versioning.No(none)
changelog-filenameFilename for generated changelog.NoCHANGELOG.md
release-notes-filenameFilename for generated release notes.NoRELEASE.md
strip-module-prefixStrip the module name from tags when the project has a single module.Nofalse
tag-version-prefixPrefix to add to tag versions (e.g., v).No(empty)

Outputs

OutputDescription
bumpedIndicates whether a version bump was performed (true or false).
changed-modulesA JSON array of modules that were changed and had their versions bumped.
created-tagsA JSON array of Git tags that were created during the versioning process.
changelog-pathsA JSON array of file paths where changelogs were generated or updated.
release-notes-pathsA JSON array of file paths where release notes were generated.

Examples

Basic Release Workflow

yaml
name: Release

on:
  push:
    branches:
      - main

permissions:
  contents: write # Required to push commits and tags

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v7
        with:
          fetch-depth: 0  # Full history for commit analysis

      #### Setup Project Requirements ########

      # Add any additional setup steps here
      # such as installing dependencies or
      # configuring the environment.

      #######################################
      
      - name: Setup Node
        uses: actions/setup-node@v6
        with:
          node-version: 24

      # Install Plugin for your project type (e.g., Gradle, etc.)
      - name: Install Versu Gradle Plugin
        run: npm i -g @versu/plugin-gradle

      - name: Run Versu
        uses: versuhq/versu@v3

      # Note: The above step will automatically
      # create tags and push changes by default.

      # This will trigger create tags events on
      # GitHub, which can be used to trigger
      # additional workflows such as publishing
      # to a package registry, etc.

Development Workflow

yaml
name: Development

on:
  pull_request:
    branches:
      - develop

jobs:
  development:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v7
        with:
          # Full history for commit analysis
          fetch-depth: 0

      #### Setup Project Requirements ########

      # Add any additional setup steps here
      # such as installing dependencies or
      # configuring the environment.

      #######################################
      
      - name: Setup Node
        uses: actions/setup-node@v6
        with:
          node-version: 24

      # Install Plugin for your project type (e.g., Gradle, etc.)
      - name: Install Versu Gradle Plugin
        run: npm i -g @versu/plugin-gradle

      - name: Run Versu in Development Mode
        uses: versuhq/versu@v3
        with:
          bump-unchanged: true
          append-snapshot: true
          create-tags: false
          push-changes: false
          generate-changelog: false

      # Add any additional steps here, such as
      # building the project, running tests, etc.

Troubleshooting

Action Not Found

Make sure you're using the correct action name:

yaml
uses: versuhq/versu@v3  # Correct
uses: versu@v3           # Wrong

No Fetch Depth

Always include full history:

yaml
- uses: actions/checkout@v7
  with:
    fetch-depth: 0  # Important!

Permission Issues

Ensure workflow has necessary permissions:

yaml
permissions:
  contents: write

Next Steps


Questions? Check GitHub Discussions or open an issue.

Released under the MIT License.