Skip to content

feat(ansible): read .python-version in release workflow#30

Merged
sbaerlocher merged 2 commits into
mainfrom
feat/release-read-python-version
Jun 17, 2026
Merged

feat(ansible): read .python-version in release workflow#30
sbaerlocher merged 2 commits into
mainfrom
feat/release-read-python-version

Conversation

@sbaerlocher

Copy link
Copy Markdown
Member

Summary

Closes the release-path caveat from #27/#28. release-ansible-collection.yml
now reads the publish Python version from the repo-root .python-version file
instead of silently defaulting to 3.11.

  • New Resolve Python version step: python_version input when set →
    .python-version first line → 3.11 fallback.
  • Input default changes 3.11 → empty. Not breaking: callers passing
    python_version are unaffected; callers that relied on the silent 3.11
    now get .python-version if present, else still 3.11.
  • Input passed via env: into the step, not interpolated into the script.
  • AGENTS.md caveat replaced with the new resolution order; CHANGELOG noted.

Test plan

  • CI green (claude-review)
  • Resolution order: input wins > .python-version > 3.11

release-ansible-collection.yml had a python_version input defaulting to 3.11
and never read the repo-root .python-version file, so a collection that bumped
.python-version still published with 3.11 unless it also passed the input.

Add a "Resolve Python version" step that picks the input when set, otherwise
the first line of .python-version, otherwise 3.11. The input default changes
from 3.11 to empty; callers passing python_version are unaffected, callers that
relied on the silent 3.11 default now get .python-version when present. This
makes .python-version authoritative for the publish build, closing the caveat
documented in AGENTS.md.

The input is passed via env into the resolve step rather than interpolated
into the script.

Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>
Comment thread .github/workflows/release-ansible-collection.yml Outdated

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clean, well-scoped change. Resolution order (input → .python-version3.11) is correct, checkout precedes the resolution step so the file is available, and the input is safely passed via env: rather than interpolated into the script. AGENTS.md and CHANGELOG are accurately updated and the non-breaking claim holds for input-passing callers.

One minor, non-blocking suggestion left inline: the 3.11 fallback only fires when .python-version is absent, not when it's empty/whitespace-only — a small guard would make the behavior match the documented contract. Drift-protection (Renovate) keeps the file populated, so this is an edge case and not blocking.

An existing but empty or whitespace-only .python-version yielded an empty
VERSION, passed as an empty python-version to setup-python instead of the
documented 3.11 fallback. Read the file into FILE_VERSION first and treat an
empty result the same as an absent file.

Signed-off-by: Simon Bärlocher <s.baerlocher@sbaerlocher.ch>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All raised issues have been addressed. The empty/whitespace .python-version edge case is now handled cleanly.

@sbaerlocher sbaerlocher merged commit f32b7a1 into main Jun 17, 2026
1 check passed
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