Skip to content

feat(core,github-action): configurable git tag format#242

Open
goulvenclech wants to merge 3 commits intomainfrom
feat/configurable-tag-format
Open

feat(core,github-action): configurable git tag format#242
goulvenclech wants to merge 3 commits intomainfrom
feat/configurable-tag-format

Conversation

@goulvenclech
Copy link
Copy Markdown
Member

@goulvenclech goulvenclech commented Apr 25, 2026

Closes #190 and #239. Made git tag format configurable via new tag_format and short_tags_format options under [git]. Templates accept {ecosystem}, {package_name}, and {version}.

sampo publish now also detects cross-ecosystem tag conflicts: it errors when two packages would produce the same git tag for the release in flight, and warns when packages share a name across ecosystems with a template that doesn't include {ecosystem} (a future version bump would silently collide). Both diagnostics suggest setting tag_format = "{ecosystem}-{package_name}-v{version}" as the fix.

What has changed?

  • sampo publish now errors when two packages would render to the same git tag for the release in flight, and warns when packages share a name across ecosystems with a template that doesn't include {ecosystem} (a future bump that aligns versions would silently collide). Both diagnostics suggest setting tag_format = "{ecosystem}-{package_name}-v{version}".
  • The GitHub Action defers to Config::default().parse_tag instead of its own parser, so a custom tag_format is honoured wherever tags are read back.

How is it tested?

Unit tests for TagTemplate (parsing, rendering, matching, non-ASCII separators, prereleases with -v), config round-trips with both templates set, and check_tag_conflicts covering certain-conflict / potential-conflict / silent / short-tags-hint / multi-ecosystem cases. Full workspace: 531 passing.

How is it documented?

crates/sampo/README.md documents both options and the conflict-detection behaviour with a copy-pasteable fix.

@goulvenclech goulvenclech self-assigned this Apr 25, 2026
@sampo-s-bot
Copy link
Copy Markdown

sampo-s-bot Bot commented Apr 25, 2026

🧭 Changeset detected

Merging this PR will release the following updates:

sampo (Cargo) — minor version bump

Minor changes

  • Made git tag format configurable via new tag_format and short_tags_format options under [git]. Templates accept {ecosystem}, {package_name}, and {version}.

    sampo publish now also detects cross-ecosystem tag conflicts: it errors when two packages would produce the same git tag for the release in flight, and warns when packages share a name across ecosystems with a template that doesn't include {ecosystem} (a future version bump would silently collide). Both diagnostics suggest setting tag_format = "{ecosystem}-{package_name}-v{version}" as the fix.

sampo-core (Cargo) — minor version bump

Minor changes

  • Made git tag format configurable via new tag_format and short_tags_format options under [git]. Templates accept {ecosystem}, {package_name}, and {version}.

    sampo publish now also detects cross-ecosystem tag conflicts: it errors when two packages would produce the same git tag for the release in flight, and warns when packages share a name across ecosystems with a template that doesn't include {ecosystem} (a future version bump would silently collide). Both diagnostics suggest setting tag_format = "{ecosystem}-{package_name}-v{version}" as the fix.

sampo-github-action (Cargo) — minor version bump

Minor changes

  • Made git tag format configurable via new tag_format and short_tags_format options under [git]. Templates accept {ecosystem}, {package_name}, and {version}.

    sampo publish now also detects cross-ecosystem tag conflicts: it errors when two packages would produce the same git tag for the release in flight, and warns when packages share a name across ecosystems with a template that doesn't include {ecosystem} (a future version bump would silently collide). Both diagnostics suggest setting tag_format = "{ecosystem}-{package_name}-v{version}" as the fix.

@github-actions github-actions Bot added documentation Improvements or additions to documentation crt:sampo Changes in Sampo CLI crate. crt:sampo-github-action Changes in Sampo's Github action crate. crt:sampo-core Changes in Sampo core logic or internal utils. labels Apr 25, 2026
Copy link
Copy Markdown
Member

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the proper solution. Sampo (and similar tools) already kinda suffer from a configuration churn due to having to support a bunch of different setup, and so the default experience should be as seamless:tm: as possible. Pit of success and all that.

I think a better solution, even though it's not intuitive is to instead force users that do encounter the edge case to configure Sampo differently. For instance for Sätteri, publishing would error because it could conflict (even if it doesn't for that specific release), telling me to configure tag_format with perhaps a suggestion.

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

Labels

crt:sampo Changes in Sampo CLI crate. crt:sampo-core Changes in Sampo core logic or internal utils. crt:sampo-github-action Changes in Sampo's Github action crate. documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support configurable Git tag format

2 participants