Skip to content

feat(python-release): attach built files, mark prereleases, run a dist check#292

Merged
CybotTM merged 1 commit into
mainfrom
feat/python-release-assets-and-prerelease
Jul 23, 2026
Merged

feat(python-release): attach built files, mark prereleases, run a dist check#292
CybotTM merged 1 commit into
mainfrom
feat/python-release-assets-and-prerelease

Conversation

@CybotTM

@CybotTM CybotTM commented Jul 23, 2026

Copy link
Copy Markdown
Member

Three gaps that make a caller lose real behaviour when it migrates off a hand-rolled release workflow. Found by the fleet audit: coding_agent_cli_toolset is the one repo in the sweep whose release workflow maps cleanly onto this reusable — and it still could not migrate without these.

input default what it fixes
release-files "" the github-release job never downloaded the dist artifact, so a caller moving off softprops/action-gh-release (normally files: dist/*) would publish a Release with no distributions attached
prerelease auto every alpha/beta/rc tag was announced as a full release
check-cmd "" python-build.yml already has it; on the release path dist validation was silently dropped

Every default reproduces current behaviour exactly.

Why prerelease: auto rather than a boolean

The motivating repo sits at version 2.0.0-alpha.6 — prerelease tags are its normal case, not an exception. A boolean would have to be flipped by hand per release.

The detection requires the marker to be delimited or to follow a digit. A plain substring test reads rc out of v1.0.0-darcy and dev out of v1.0.0-developer, and would announce final releases as prereleases:

  v2.0.0-alpha.6           -> prerelease  ok
  v1.0.0-rc.1              -> prerelease  ok
  v2.0.0.dev3              -> prerelease  ok
  v1.2.3a1                 -> prerelease  ok      # attached PEP 440 form
  v1.2.3rc2                -> prerelease  ok
  v1.2.3                   -> full        ok
  v1.0.0-darcy             -> full        ok      # contains "rc"
  v1.0.0-developer         -> full        ok      # contains "dev"
  v1.0.0+build.5           -> full        ok

16 tags verified, all correct. true/false remain available for callers that want to decide explicitly.

Note on release-files

The glob is word-split into argv so a caller cannot inject shell metacharacters, and the job fails loudly if the pattern matches nothing — attaching zero files silently is the failure mode this input exists to prevent.

…t check

Three gaps that make a caller lose real behaviour when it migrates off a
hand-rolled release workflow:

- release-files: the github-release job only ran `gh release create
  --generate-notes` and never downloaded the dist artifact, so a caller
  moving off softprops/action-gh-release (normally configured with
  `files: dist/*`) would publish a Release with no distributions attached.
- prerelease: `auto` (default) marks the Release a prerelease when the tag
  carries a pre/dev segment. Without it every alpha/beta/rc tag is announced
  as a full release — the realistic case for a project on 2.0.0-alpha.6.
- check-cmd: python-build.yml already has it; on the release path dist
  validation was silently dropped.

The tag detection requires the marker to be delimited or to follow a digit.
A plain substring test reads "rc" out of v1.0.0-darcy and "dev" out of
v1.0.0-developer and would mark final releases as prereleases; verified
against 16 tags including those two.

Defaults reproduce the previous behaviour exactly: no files attached, no
prerelease marking, no check command.

Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
Copilot AI review requested due to automatic review settings July 23, 2026 15:52
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CybotTM
CybotTM merged commit 7999d0b into main Jul 23, 2026
11 of 12 checks passed
@CybotTM
CybotTM deleted the feat/python-release-assets-and-prerelease branch July 23, 2026 15:54
CybotTM added a commit to netresearch/coding_agent_cli_toolset that referenced this pull request Jul 23, 2026
Replaces four hand-rolled jobs (**10** step-level third-party actions)
with one caller job and **zero** stray uses. Net −116/+39.

### Nothing working is lost, because the publish path never worked

Verified against the repo, not assumed:

```
Actions secrets : none          <- PYPI_API_TOKEN / TEST_PYPI_API_TOKEN resolved to empty
tags            : 0
releases        : 0
environments    : copilot       <- no `pypi` environment
pypi.org/cli-audit : HTTP 404
```

Rather than carry a job guaranteed to fail, publishing is switched
**off** and the two prerequisites are documented in the workflow itself:

1. a PyPI **Trusted Publisher** for
`netresearch/coding_agent_cli_toolset`, pointing at this workflow and
the environment the reusable names;
2. that GitHub Environment.

Flipping `publish-pypi: true` is then the entire change — the reusable
uploads via OIDC, so **no token is needed at all**. That is a strictly
better position than the secret-based setup this replaces.

### Two behaviours were added to the reusable first, so they survive

The audit found this repo was the only one in the fleet sweep whose
release workflow mapped cleanly onto `python-release.yml` — and even it
could not migrate without
[netresearch/.github#292](netresearch/.github#292):

| | before | after |
|---|---|---|
| release assets | `softprops/action-gh-release` with `files: dist/*` |
`release-files: dist/*` |
| prerelease | `contains(github.ref, 'alpha'\|'beta'\|'rc')` |
`prerelease: auto` |

`auto` reproduces the old expression **and** covers the PEP 440
spellings it missed (`v1.2.3a1`, `v1.2.3rc2`, `v2.0.0.dev3`), while not
tripping on tags that merely contain those letters (`v1.0.0-darcy`,
`v1.0.0-developer`). At version `2.0.0-alpha.6` prerelease tags are the
normal case here, so this is not hypothetical.

### Dropped deliberately as local quirks

The CHANGELOG-derived release body (replaced by `--generate-notes`) and
the separate TestPyPI dispatch path.
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.

2 participants