ci: add PyPI publish workflow with Trusted Publisher OIDC#148
Draft
abubnalitic-nbl wants to merge 1 commit into
Draft
ci: add PyPI publish workflow with Trusted Publisher OIDC#148abubnalitic-nbl wants to merge 1 commit into
abubnalitic-nbl wants to merge 1 commit into
Conversation
Triggers on `v*.*.*` tags created by `release-finalize.yml`, building the sdist and wheel with `uv build` and uploading via PyPI Trusted Publishers (no API token in the repo). Build and publish are split across jobs so the OIDC token is only available to the publish step, mirroring the docker-publish.yml build/merge split. SLSA build provenance attestation matches the existing docker-publish workflow. Setup prerequisites (one-time, owned by the `netboxlabs-publisher` PyPI account) are documented in the workflow header. Do not merge until those are configured — see #130. Relates to #130
| subject-path: "dist/*" | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a PyPI publish workflow so a
v*.*.*tag — already produced byrelease-finalize.yml— also pushes the sdist and wheel to PyPI. Uses PyPI Trusted Publishers (OIDC), so no API token is stored in the repo.The build and publish steps are split across two jobs so the OIDC token (
id-token: write) is only present in the publish job, not whileuv buildis running — same pattern the existingdocker-publish.ymluses for its build/merge split. SLSA build provenance is attested for the uploaded artifacts, matching the docker workflow.Draft — do not merge yet
Merging this workflow alone publishes nothing; the OIDC exchange fails closed without the matching PyPI-side registration. Before this can land, the holder of the
netboxlabs-publisherPyPI account needs to:netbox-mcp-server, pointing at:netboxlabsnetbox-mcp-serverpypi-publish.ymlpypipypiGitHub Environment in repo Settings → Environments, with a deployment branch/tag rule restricting it tov*tagspypienvironment for the first runThe workflow header in
pypi-publish.ymldocuments these steps inline so the access holder can configure straight from the file.Verification done locally
uv buildproducesnetbox_mcp_server-1.2.0.tar.gz(188K) andnetbox_mcp_server-1.2.0-py3-none-any.whl(25K)[project.scripts]already wiresnetbox-mcp-server→netbox_mcp_server.server:main, souvx netbox-mcp-serverwill work once publishedRelates to #130.