You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
publish-to-test-pypi.yml also pushes to non-test PyPI #1935
I find this a bit confusing while stepping though this guide:
it is suggested to create a workflow named publish-to-test-pypi.yml, but later it turns out that the workflow also pushes to the real (non-test) PyPI.
Wouldn't it be better to rename this file to just publish-to-pypi.yml?
Note that's a bit annoying if you find this out later and want to rename the workflow file, because you have to redo the whole "add trusted publisher" thing again (as it involves the workflow file name)
@soxofaan There is a separate issue on the same web site (at least about update by Nov 18, 2025; but probably present already for a couple of days) when it comes to section The whole CI/CD workflow and its workflow file: the conditional.
To familiarize myself with CI/CD for an eventual publication to either of the two sites for my greet2org demo package, I assumed the line
if: startsWith(github.ref, 'refs/tags/')
to be safe to work with GitHub's environment. Well, on one hand there is the affirmative yes (if the project and yml file is known to test.pypi.org and the separate register of pypi.org). On the other hand, GitHub occasionally/systematically displays the two children which successfully run differently: one by the expected green check mark, the other as skipped:
I'm not able to tell if this is (a perhaps temporary) issue with GitHub when viewing the repository with a web browser. For me, this was a source of confusion why git tag and git push --follow-tags didn't work the usual way. As it turned out, it probably wasn't an problem of git, and the manual increment of the version in pyproject.toml file and tag set likely wasn't necessary either. Maybe it is safer to omit if-conditionals in workflows to build and publish altogether, too.
Maybe it is safer to omit if-conditionals in workflows to build and publish altogether, too.
The idea is that if you figure out how to produce unique version strings, then you can publish to TestPyPI continuously. And "real" PyPI only gets uploads when actual release is triggered. Personally, I prefer workflow_dispatch instead of the tag shenanigans for many reasons but never refactored that example.
(looks like I started typing this yesterday but never clicked send 🤦)
Note that's a bit annoying if you find this out later and want to rename the workflow file, because you have to redo the whole "add trusted publisher" thing again (as it involves the workflow file name)
Fair. I don't know how it ended up being called like that. Likely my oversight.
Feel free to send a PR with the name update. I also wanted to eventually improve it with more advanced examples but never got to it. So every small patch helps.
@webknjaz Thank you for your clarification it is GitHub's rules how to display things.
Second, to me, your argument to use a separate fully automated workflow for the CD to test.pypi.org, and one requiring an additional intervention for pypi.org is convincing. Then, two separately maintained indices (and on the user's side, separate setup of trusted publishers and environments) equally is sensible, too. My issue thus is resolved.
@webknjaz You are correct, my error; jobs. As in "jobs, which may consist of multiple steps like the checkout action" and "one, or multiple jobs may constitute a workflow".
Reacted by 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко)
Activity
soxofaan commentedon Oct 20, 2025
Note that's a bit annoying if you find this out later and want to rename the workflow file, because you have to redo the whole "add trusted publisher" thing again (as it involves the workflow file name)
nbehrnd commentedon Nov 19, 2025
@soxofaan There is a separate issue on the same web site (at least about update by Nov 18, 2025; but probably present already for a couple of days) when it comes to section
The whole CI/CD workflowand its workflow file: the conditional.To familiarize myself with CI/CD for an eventual publication to either of the two sites for my greet2org demo package, I assumed the line
to be safe to work with GitHub's environment. Well, on one hand there is the affirmative yes (if the project and yml file is known to test.pypi.org and the separate register of pypi.org). On the other hand, GitHub occasionally/systematically displays the two children which successfully run differently: one by the expected green check mark, the other as skipped:
I'm not able to tell if this is (a perhaps temporary) issue with GitHub when viewing the repository with a web browser. For me, this was a source of confusion why
git tagandgit push --follow-tagsdidn't work the usual way. As it turned out, it probably wasn't an problem ofgit, and the manual increment of the version inpyproject.tomlfile and tag set likely wasn't necessary either. Maybe it is safer to omit if-conditionals in workflows to build and publish altogether, too.webknjaz commentedon Nov 19, 2025
That's how conditional jobs are handled by GHA. Not a bug.
webknjaz commentedon Nov 19, 2025
The idea is that if you figure out how to produce unique version strings, then you can publish to TestPyPI continuously. And "real" PyPI only gets uploads when actual release is triggered. Personally, I prefer
workflow_dispatchinstead of the tag shenanigans for many reasons but never refactored that example.soxofaan commentedon Nov 19, 2025
Thanks for responding, but as far as I understand this is off-topic w.r.t. what I want to highlight in this issue:
.github/workflows/publish-to-test-pypi.ymlso I'd propose to update the user guide to suggest something like
.github/workflows/publish-to-pypi.ymlfrom the startwebknjaz commentedon Nov 20, 2025
(looks like I started typing this yesterday but never clicked send 🤦)
Fair. I don't know how it ended up being called like that. Likely my oversight.
Feel free to send a PR with the name update. I also wanted to eventually improve it with more advanced examples but never got to it. So every small patch helps.
webknjaz commentedon Nov 20, 2025
We could also make it a more generic
publish-to-package-indices.yaml.nbehrnd commentedon Nov 21, 2025
@webknjaz Thank you for your clarification it is GitHub's rules how to display things.
Second, to me, your argument to use a separate fully automated workflow for the CD to test.pypi.org, and one requiring an additional intervention for pypi.org is convincing. Then, two separately maintained indices (and on the user's side, separate setup of trusted publishers and environments) equally is sensible, too. My issue thus is resolved.
webknjaz commentedon Nov 21, 2025
You probably meant jobs, not workflows, right?
nbehrnd commentedon Nov 21, 2025
@webknjaz You are correct, my error; jobs. As in "jobs, which may consist of multiple steps like the checkout action" and "one, or multiple jobs may constitute a workflow".
soxofaan commentedon Nov 23, 2025
-> created PR #1961
webknjaz commentedon Nov 23, 2025
Thanks!
Rename publish-to-test-pypi.yml to publish-to-pypi.yml #1935
Merge pull request #1961 from soxofaan/issue1935-publish-topypi