ci: publish stackone-ai using PyPI trusted publishing

GL
2d ago
+193-34

Publishing currently relies on a stored PyPI API token. This change keeps the existing Release Please flow and uploads tested artifacts using GitHub OIDC through PyPI Trusted Publishing.

The build job checks out the exact release commit, verifies it belongs to main and its package version matches the release, runs the existing test suite, and installs both the wheel and source archive in isolated environments. The separate publish job has no source checkout, downloads only its own run's artifacts, and is the only job with id-token: write. Workflow PRs exercise the build without publishing.

Required setup before merging

The current PyPI account cannot manage stackone-ai (403). A project owner must add the publisher below before this PR is merged.

PyPI publisher fieldValue
PyPI projectstackone-ai
OwnerStackOneHQ
Repositorystackone-ai-python
Workflow filenamerelease.yaml
Environmentpypi

The GitHub pypi environment has already been configured and verified to allow only the main branch, with no tag rules. No new secret is needed. Keep the existing token until the first successful trusted publish; then remove the unused secret and revoke the token only after checking other uses. Full release instructions are in .github/RELEASING.md.

Validation and review

  • Local tests: 871 passed. Ruff, ty, and the required make format / make test checks passed.
  • Built and installed the wheel and source archive successfully; package imports and installed versions verified.
  • Actionlint and diff checks passed. Ten executable source/version/isolation guard probes passed for this repository, including missing or wrong release metadata and a tag attempting to shadow origin/main.
  • Security, correctness, and maintainability reviews completed. No unresolved findings in this change. Aikido critical/high issues were checked for the changed scope.

GitHub CI passed, including the new release build, package installation checks, and the Python test matrix. The publish job was skipped as expected on this PR. The Aikido PR check was skipped on the draft; its existing critical/high alerts were inspected separately for this diff. An actual OIDC upload is intentionally deferred until the next release; no package version or application dependencies change here.