Skip to content

Add GitHub Actions for Release Automation#2

Open
nutcas3 wants to merge 5 commits into
mamba-studio:mainfrom
nutcas3:main
Open

Add GitHub Actions for Release Automation#2
nutcas3 wants to merge 5 commits into
mamba-studio:mainfrom
nutcas3:main

Conversation

@nutcas3

@nutcas3 nutcas3 commented May 15, 2026

Copy link
Copy Markdown

Added GitHub Actions workflows to automate the release and tagging process for TypedMemory with semantic versioning support.

New Files

  1. .github/workflows/create-tag.yml - Manual workflow to create and push git tags
  2. .github/workflows/auto-tag.yml - Automated semantic versioning workflow
  3. Updated .github/workflows/release.yml - Enhanced release workflow with prerelease detection

Workflow Details

Auto Tag Workflow (New)

  • Automatically triggers on push to main branch
  • Can be triggered by adding the "release" or "autorelease" label to a pull request
  • Can be triggered by commenting "/release" or "/autorelease" on an issue or pull request
  • Can be triggered manually via GitHub Actions UI with optional force_bump parameter
  • Analyzes commit messages using conventional commits format
  • Determines version bump based on commit types:
    • Breaking changes (feat! or BREAKING CHANGE) → Major version bump (e.g., 0.1.0 → 1.0.0)
    • Features (feat) → Minor version bump (e.g., 0.1.0 → 0.2.0)
    • Other commits (fix, chore, etc.) → Patch version bump (e.g., 0.1.0 → 0.1.1)
  • Handles multiple commits per push by finding the highest version bump
  • Updates pom.xml with new version
  • Creates and pushes the git tag
  • Triggers the release workflow automatically

Create Tag Workflow (Enhanced)

  • Manually triggered workflow to create and push version tags
  • Inputs:
    • version: Tag name (e.g., v0.2.0)
    • prerelease: Boolean flag to mark as prerelease
  • Updates pom.xml with the specified version
  • Creates and pushes the git tag
  • Triggers the release workflow automatically

Release Workflow

  • Triggers on tag pushes (v*) and manual dispatch
  • Manual dispatch allows specifying version and prerelease flag directly
  • Sets up JDK 25 with Maven cache
  • Builds the project with Maven
  • Runs tests
  • Generates Javadoc
  • Creates GitHub release with artifacts:
    • Main JAR file
    • Sources JAR
    • Javadoc JAR
  • Automatically detects prereleases from tag names containing: -alpha, -beta, -rc, -prerelease, or prerelease
  • Marks releases as prerelease accordingly

How to Use

Automatic Semantic Versioning (Recommended)

Use conventional commits in your commit messages:

git commit -m "feat: add new memory layout feature"
git commit -m "fix: resolve memory leak"
git commit -m "feat!: breaking API change"
git commit -m "chore: update dependencies"

When you push to main, the auto-tag workflow will:

  1. Analyze all commits since the last tag
  2. Determine the appropriate version bump
  3. Update pom.xml with the new version
  4. Create and push a git tag
  5. Trigger the release workflow automatically

Manual Tag Creation

If you need to create a specific version tag manually:

  1. Navigate to the Actions tab in the GitHub repository
  2. Select "Create Tag" workflow from the left sidebar
  3. Click "Run workflow"
  4. Enter the version tag (e.g., v0.2.0)
  5. Check the prerelease box if this is a prerelease
  6. Click the green "Run workflow" button

The workflow will:

  • Update pom.xml with the specified version
  • Create and push the git tag
  • Automatically trigger the release workflow
  • Build, test, and create the GitHub release with all artifacts

Manual Release (Without Tag)

If you need to create a release without creating a tag first:

  1. Navigate to the Actions tab in the GitHub repository
  2. Select "Release" workflow from the left sidebar
  3. Click "Run workflow"
  4. Enter the version (e.g., v0.2.0)
  5. Check the prerelease box if this is a prerelease
  6. Click the green "Run workflow" button

The workflow will:

  • Build, test, and create the GitHub release with all artifacts
  • Create the release with the specified version tag

Label/Comment Trigger

To trigger a release via label or comment:

Via Label:

  • Add the "release" or "autorelease" label to a pull request
  • The auto-tag workflow will run and create a patch version bump

Via Comment:

  • Comment "/release" or "/autorelease" on an issue or pull request
  • The auto-tag workflow will run and create a patch version bump

Manual Auto-Tag with Force Bump

To manually trigger the auto-tag workflow with a specific version bump:

  1. Navigate to the Actions tab in the GitHub repository
  2. Select "Auto Tag" workflow from the left sidebar
  3. Click "Run workflow"
  4. Select the force_bump option (major, minor, or patch)
  5. Click the green "Run workflow" button

The workflow will:

  • Apply the specified version bump
  • Update pom.xml with the new version
  • Create and push the git tag
  • Automatically trigger the release workflow

Alternative: Local Tag Creation

You can also create tags locally:

git tag -a v0.2.0 -m "Release v0.2.0"
git push origin v0.2.0

This will trigger the release workflow automatically. Note: You'll need to manually update pom.xml with the new version.

Prerelease Naming Convention

To mark a release as a prerelease, include any of these in the tag name:

  • -alpha (e.g., v0.2.0-alpha)
  • -beta (e.g., v0.2.0-beta)
  • -rc (e.g., v0.2.0-rc1)
  • -prerelease (e.g., v0.2.0-prerelease)
  • prerelease (e.g., v0.2.0prerelease)

The release workflow will automatically detect these and mark the release as a prerelease.

Benefits

  • Automated semantic versioning based on conventional commits
  • Reduces manual errors in version management
  • Consistent build and test execution for all releases
  • Automatic artifact generation and attachment
  • Prerelease detection based on naming convention
  • Handles multiple commits intelligently (finds highest version bump)
  • No Docker required, uses native GitHub Actions
  • Both automated and manual release options available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant