Skip to content

Make the PyPI publish job opt-in - #6

Merged
degoldschmidt merged 1 commit into
mainfrom
ci/gate-pypi-publish
Aug 21, 2026
Merged

Make the PyPI publish job opt-in#6
degoldschmidt merged 1 commit into
mainfrom
ci/gate-pypi-publish

Conversation

@degoldschmidt

Copy link
Copy Markdown
Collaborator

Makes the PyPI publish job opt-in, so tagging v0.2.0 produces a green release run
instead of a red one.

Why

flypad is not on PyPI and no trusted publisher is configured for this repository. As the
workflow stood, every tag would build the distributions, smoke-test the wheel — both fine —
and then fail on a publish step that could never have succeeded. A release run that is
always red is worse than no signal at all: it trains you to ignore the one workflow whose
failures matter most.

Worth noting the job could not have worked even with a publisher configured until the
previous PR: uv build was producing a 124 MB sdist, over PyPI's 100 MB per-file limit.
That is fixed on main; this PR handles the remaining half.

What changes

One condition on the publish job:

if: vars.PYPI_PUBLISH == 'true'

Unset, the job is skipped — grey, which is the honest signal for "not enabled", as
opposed to red for "broken". build and smoke still run on every tag, so the release is
still verified end-to-end; only the upload is withheld.

Enabling PyPI later needs no workflow edit:

  1. register a trusted publisher on PyPI for this repository (workflow release.yml,
    environment pypi);
  2. create the pypi environment under Settings → Environments;
  3. set the repository variable PYPI_PUBLISH to true under
    Settings → Secrets and variables → Actions → Variables.

Those steps are recorded in the job's comment so they are there when they are wanted,
along with the reminder that publishing is irreversible — a version, once accepted by PyPI,
cannot be reused.

Verification

gh variable list reports no repository variables, so the gate currently evaluates false
and the job will skip. Tagging v0.2.0 after this merges should give build ✅, smoke ✅,
publish ⏭️.

Nothing else in the workflow changes, and release.yml only triggers on v* tags, so this
cannot affect ci or docs.

Order

This needs to be on main before the v0.2.0 tag is created — a tag created first
would still carry the ungated job and fail red on the run.

flypad is not on PyPI and there is no trusted publisher configured, so as it
stood every tag would build and smoke-test cleanly and then fail red on a publish
step that could never have worked. A red job on every release is noise that
trains you to ignore release runs.

The job is now gated on a repository variable, PYPI_PUBLISH. Unset, the job is
skipped — grey, which is the honest signal for "not enabled" rather than "broken".
Enabling it later needs no workflow edit: register the trusted publisher on PyPI,
create the `pypi` environment, set the variable to "true".

Verified the variable is currently unset, so v0.2.0 will tag green with build and
smoke running and publish skipped.
@degoldschmidt
degoldschmidt merged commit cec19f8 into main Aug 21, 2026
6 checks passed
@degoldschmidt
degoldschmidt deleted the ci/gate-pypi-publish branch August 21, 2026 14:43
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