Skip to content

.github, ts_python: add GitHub workflow to publish to PyPI #101

Merged
dylan-tailscale merged 1 commit intomainfrom
dylan/pypi-pipeline
Apr 22, 2026
Merged

.github, ts_python: add GitHub workflow to publish to PyPI #101
dylan-tailscale merged 1 commit intomainfrom
dylan/pypi-pipeline

Conversation

@dylan-tailscale
Copy link
Copy Markdown
Collaborator

@dylan-tailscale dylan-tailscale commented Apr 16, 2026

Adds a GitHub workflow to build Python 3.12 wheels for Linux (x86_64/ARM64) and macOS (ARM64), then publish them to PyPI for tagged releases. The GitHub repository now has Environments configured for PyPI ("pypi") and Test PyPI ("testpypi") under Settings -> Environments which require approval to deploy to, and both the PyPI and Test PyPI projects for tailscale-py have Trusted Publishers set up with GitHub to allow tokenless publication of wheels from the python.yml workflow.

Confirmed working with Test PyPI; the 0.2.0.post2, 0.2.0.post3, and 0.2.0.post4 releases were published from this workflow, and subsequently yanked. The latest failed publish is intentional, to test attempting to publish a different wheel for an existing release (0.2.0, which was yanked) on testpypi.

Also configures ci.yml to run on tag creation for v* tags.

Closes #43.

@dylan-tailscale dylan-tailscale self-assigned this Apr 16, 2026
@dylan-tailscale dylan-tailscale added the maintenance Updating dependencies, bumping Rust MSRV, etc label Apr 16, 2026
@dylan-tailscale dylan-tailscale force-pushed the dylan/pypi-pipeline branch 2 times, most recently from c429c3d to 6bc1e83 Compare April 17, 2026 17:39
@dylan-tailscale dylan-tailscale force-pushed the dylan/pypi-pipeline branch 2 times, most recently from 0cc1f8b to 1ee1dc8 Compare April 20, 2026 16:39
@dylan-tailscale dylan-tailscale marked this pull request as ready for review April 20, 2026 16:44
@dylan-tailscale dylan-tailscale removed the maintenance Updating dependencies, bumping Rust MSRV, etc label Apr 20, 2026
Copy link
Copy Markdown
Collaborator

@npry npry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, nothing blocking

Comment thread .github/workflows/python.yml Outdated
Comment on lines +81 to +82
# For Test PyPI, change this to "testpypi".
environment: pypi
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nonblocking: I think you can make this an argument in workflow_dispatch, fwiw

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this, but it appears workflow dispatch vars aren't provided to the workflow unless the workflow itself is on the default branch (?!?). Therefore, I've temporarily made this an env var via env, and commented-out the on.workflow_dispatch.inputs section; once this makes it to main, I'll create a follow-up PR to do this via workflow_dispatch. Wdyt?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah you don't get the inputs context at all outside of workflow_dispatch and I think workflow_call? I don't believe it'll appear once this is merged, iiuc you just get the dispatch button when that happens, but the restriction about inputs still applies if it's not being triggered that way — you need to pick an alternate value if it's through a tag push or pr. I selected with case in #126

Comment thread .github/workflows/python.yml Outdated
Comment thread .github/workflows/python.yml Outdated
@dylan-tailscale
Copy link
Copy Markdown
Collaborator Author

@npry probably worth a brief re-review; consolidated and re-arranged a lot based on your comments, added Rust caching, and am going to have to address the GitHub workflow_dispatch tomfoolery in a follow-up. Note the failed publish is intentional - I tried to re-publish 0.2.0 to testpypi, which was yanked. Let me know if you have any issues!

Copy link
Copy Markdown
Collaborator

@npry npry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

along the lines of my reply, I think it won't fix to merge to main? but no harm in merging as is and following up also, either way

Adds GitHub workflow to build Python 3.12 wheels for Linux (x86_64/ARM64) and
macOS (ARM64), perform a publish dry run, then actually publish them to PyPI
for tagged releases. GitHub repository has Environments configured for PyPI
("pypi") and Test PyPI ("testpypi"), and both PyPI and Test PyPI projects for
`tailscale-py` have Trusted Publishers set up to allow tokenless publication
of wheels from the workflow. The GitHub environments require approval from a
team member prior to running any jobs and will only allow jobs to run on tags.
Additionally, the "publish" job in the workflow is gated on release tags or
"workflow_dispatch" only.

Signed-off-by: Dylan Bargatze <dylan@tailscale.com>
@dylan-tailscale dylan-tailscale enabled auto-merge (squash) April 22, 2026 16:08
@dylan-tailscale dylan-tailscale merged commit 0f39e25 into main Apr 22, 2026
12 of 13 checks passed
@dylan-tailscale dylan-tailscale deleted the dylan/pypi-pipeline branch April 22, 2026 16:16
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.

.github, ts_python: add GitHub workflow to publish to PyPi

2 participants