Skip to content

Add version comparison with crates.io before publishing #193

@RAprogramm

Description

@RAprogramm

Objective

Add automated version comparison to prevent publishing versions that are equal to or lower than the current version on crates.io.

Current Behavior

Release workflow publishes to crates.io when a tag v* is pushed, checking only that the tag matches Cargo.toml version. This can lead to:

  • Attempting to publish the same version twice (fails with cryptic error)
  • Accidentally pushing an older version
  • No clear feedback about version conflicts

Desired Behavior

Before attempting to publish:

  1. Fetch current version from crates.io API
  2. Compare with tag version
  3. If tag version > crates.io version: proceed with publish
  4. If tag version <= crates.io version: skip publish with clear message

Implementation

  • Use crates.io API to fetch current max_version
  • Implement semver comparison (handle major.minor.patch)
  • Add check step after "Ensure tag matches Cargo.toml version"
  • Provide clear output messages for each scenario

Benefits

  • Prevents publishing errors
  • Clear feedback on version conflicts
  • Automatic skip for already-published versions
  • Better developer experience

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions