Skip to content

Github Action: automated pre-release workflow #86

@goulvenclech

Description

@goulvenclech

Describe the problem

Currently, pre-release management in Sampo requires manual CLI commands:

  • sampo pre enter --label alpha to enter pre-release mode
  • sampo pre exit to exit pre-release mode and stabilize
  • Manual decisions about when to transition between pre-release stages

The GitHub Action currently:

  • Creates a release PR when changesets exist on a release branch
  • Creates a stabilize PR when the release plan targets pre-release versions (to exit pre-release mode)
  • Publishes crates and creates tags when the release PR is merged

This behaviour require manual CLI commands, and do not enforce any structured path through pre-release stages.

What's the proposed feature?

Add configuration options to sampo-github-action to automatically manage pre-release transitions without requiring manual CLI intervention. This feature allows to enforces a structured path through pre-release stages (alpha → beta → rc) and automatically creates PRs for entering, advancing through, and stabilizing pre-releases based on semantic version bump levels.

action.yml's options could be something like:

inputs:
  prerelease-stages:
    description: "Ordered list of pre-release stages (e.g., 'alpha,beta,rc')"
    required: false
  prerelease-on-minor:
    description: "Pre-release stage to enter for minor version bumps (e.g., 'rc')"
    required: false
  prerelease-on-major:
    description: "Pre-release stage to enter for major version bumps (e.g., 'alpha')"
    required: false
  prerelease-on-patch:
    description: "Pre-release stage to enter for patch version bumps (leave empty to skip)"
    required: false

Hypothetical workflow

1. Entering Pre-Release Mode

Trigger: When the bump level in the current release PR exceeds a configured threshold.

Behavior:

  • Analyze the release plan from sampo release --dry-run
  • Detect the highest semantic bump level (patch, minor, or major) among affected packages
  • If the bump level matches a configured pre-release trigger:
    • Create a new PR to enter pre-release mode at the specified stage
    • PR branch: pre-enter-<stage>/<base-branch> (e.g., pre-enter-alpha/main)
    • PR title: Enter <stage> (<base-branch>)
    • PR body: Explain which packages will enter pre-release

2. Operating in Pre-Release Mode

When packages are in pre-release mode, the action creates multiple PRs:

A. Continue Pre-Release PR (existing behavior)
  • Branch: pre-release/<base-branch> (or configured pr-branch)
  • Title: Pre-release (<base-branch>) (or configured pr-title)
  • Purpose: Increment pre-release version (e.g., 2.0.0-alpha.12.0.0-alpha.2)
  • Trigger: New changesets added

B. Stabilize PR (existing behavior)

  • Branch: stabilize/<base-branch> (or configured stabilize-pr-branch)
  • Title: Release stable (<base-branch>) (or configured stabilize-pr-title)
  • Purpose: Exit pre-release mode and release stable version (e.g., 2.0.0-alpha.22.0.0)
  • Condition: Only shown when at the final pre-release stage (last in prerelease-stages list)

C. Advance Pre-Release Stage PR (new)

  • Branch: pre-advance-<next-stage>/<base-branch> (e.g., pre-advance-beta/main)
  • Title: Advance pre-release: <current-stage> → <next-stage> (<base-branch>)
  • Purpose: Move to the next pre-release stage (e.g., alphabeta)
  • Condition: Only shown when not at the final stage in prerelease-stages
  • Behavior: When merged, exits current pre-release and enters the next stage

Open questions

  1. Configuration location: Should these options be in the GitHub Action inputs or in .sampo/config.toml?

    • If in Sampo config, they could also enforce the pre-release path in the CLI commands (e.g., sampo pre enter would default to the configured stages, while still allowing custom labels)
    • This would ensure consistency between CLI and GitHub Action workflows
  2. Stabilize PR visibility: Should the stabilize PR only appear at the final stage, or should it always be available?

  3. Multiple packages: If different packages are at different pre-release stages, how should the action behave?

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCProposed feature or change - open for feedbackcrt:sampo-github-actionChanges in Sampo's Github action crate.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions