Skip to content

ci: support release candidate publishing and PEP 440 release validation - #309

Draft
jplbrun wants to merge 2 commits into
mainfrom
feat/afsdk-4181-rc-release
Draft

ci: support release candidate publishing and PEP 440 release validation#309
jplbrun wants to merge 2 commits into
mainfrom
feat/afsdk-4181-rc-release

Conversation

@jplbrun

@jplbrun jplbrun commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Disclaimer: Do not include SAP-internal or customer-specific information in this PR (e.g. internal system URLs, customer names, tenant IDs, or confidential configurations). This is a public repository.

Description

Hardens and documents the existing support for publishing release candidates (RCs) to PyPI, and updates the version-bump automation to understand PEP 440 pre-release versions.

Previously the version-bump check used sort -V, which incorrectly treats 1.0.0rc1 as newer than the final 1.0.0. When the check ran for a source-changing PR, it could therefore misclassify an RC-to-final promotion as a regression. The release workflow also did not validate the release tag or the GitHub pre-release setting.

This PR:

  • Replaces the shell sort -V comparison in check-version-bump.yaml with a Python script (check_version_bump.py) that uses PEP 440 ordering, so 1.0.0rc1 -> 1.0.0 is accepted and regressions are still rejected.
  • Adds a validation step to release.yml (validate_release.py) that fails the publish before build if any of these are wrong: the version is not normalized PEP 440, the tag does not equal v<version>, or the GitHub pre-release setting does not match whether the version is a pre-release.
  • Reads the current pre-release setting via gh api on each run, so a maintainer can correct a pre-release flag mismatch and re-run the failed workflow without creating a new release. (A tag mismatch still requires publishing a new release with the correct tag.)
  • Adds unit tests for both scripts under tests/ci/.
  • Updates docs/RELEASE.md with the RC cycle, the pre-release/latest guidance, and RC install instructions.

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring
  • Dependency update

How to Test

  1. Run the script unit tests: uv run pytest tests/ci/test_versioning_scripts.py -v.
  2. Confirm the version-bump check accepts 1.0.0rc1 -> 1.0.0 and rejects 1.0.0 -> 1.0.0rc1 (regression).
  3. Confirm validate_release.py rejects a tag/version mismatch and a pre-release-flag mismatch, and accepts matching metadata for both an RC and a stable version.

Expected result: the RC-to-final bump is accepted, mismatched release metadata fails before publishing, and correct metadata passes.

Checklist

  • I have read the Contributing Guidelines
  • I have verified that my changes solve the issue
  • I have added/updated automated tests to cover my changes
  • All tests pass locally
  • I have verified that my code follows the Code Guidelines
  • I have updated documentation (if applicable)
  • I have added type hints for all public APIs
  • My code does not contain sensitive information (credentials, tokens, etc.)
  • I have followed Conventional Commits for commit messages

Breaking Changes

None

Additional Notes

N/A

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