Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add a GitHub Action to publish to PyPI #347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 2, 2025
Merged

Add a GitHub Action to publish to PyPI #347

merged 2 commits into from
Apr 2, 2025

Conversation

cclauss
Copy link
Member

@cclauss cclauss commented Mar 19, 2025

Copy link
Member

@aaronliu0130 aaronliu0130 left a comment

Choose a reason for hiding this comment

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

Blocked by the need for repo secrets.

@@ -0,0 +1,119 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on: push
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure this should be run every commit?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. We want to build each push but the process will stop at line 35 if this is not a release.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure why we need to build each push.

Copy link
Member Author

Choose a reason for hiding this comment

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

Knowing when we can no longer build the project is quite a useful diagnostic.

Copy link
Member Author

@cclauss cclauss Mar 21, 2025

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

It says that it's "One popular choice". IMO build breaking while the normal CI doesn't break would be so rare that testing it only on tag push is enough (we don't need to release when we push a tag).

That said, I don't care about this facet too much.

Comment on lines +39 to +40
environment:
name: pypi
Copy link
Member

Choose a reason for hiding this comment

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

I have added publisher on pypi

Repository: cpplint/cpplint
Workflow: release.yml
Environment name: pypi

However, I am a bit concerned about this bit - has a "pypi" environment been created in the Github repo settings?
I dont have access to the Environments section of the GitHub repo settings.

Copy link
Member

Choose a reason for hiding this comment

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

Everyone in the cpplint org can see that tab; I don't think you accepted the maintainer invite. Could you check all your folders for the subject [GitHub] @mattyclarkson has invited you to join the @cpplint organization dated 9.5 hours ago, xx:30? I also just sent you another one a few minutes ago.

Anyways, I see there's a "testpypi" environment with nothing in it. I suspect that to be a test thing from many years ago and that @cclauss has perhaps yet to set up the environment.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I can move this forward but I will need a few days to look into it.

Copy link
Member Author

@cclauss cclauss Mar 30, 2025

Choose a reason for hiding this comment

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

I have added publisher on pypi
Repository: cpplint/cpplint
Workflow: release.yml
Environment name: pypi

Can you please add a second publisher with the same settings but on:
Environment name: testpypi

@cclauss
Copy link
Member Author

cclauss commented Apr 1, 2025

I have commented out the job step for publication to test.pypi.org because @jayvdb does not yet have admin access there. He does have admin access to pypi.org so production releases should work once this pull request is approved and merged.

@aaronliu0130
Copy link
Member

If needed we could test deployment on a new TestPyPI package we create.

@cclauss cclauss dismissed aaronliu0130’s stale review April 1, 2025 19:23

Blocked by the need for repo secrets.

I have commented out the job step for publication to test.pypi.org

@aaronliu0130
Copy link
Member

I think we should test that it works by pushing to whatever TestPyPI package we may push to first. Doesn't have to be the cpplint package; we could e.g. create a cpplint2 package for temporary testing.

@cclauss cclauss merged commit e9e17f0 into develop Apr 2, 2025
15 checks passed
@cclauss cclauss deleted the publish-to-pypi branch April 2, 2025 11:02
@aaronliu0130
Copy link
Member

https://github.com/cpplint/cpplint/actions/runs/14219458049/job/39843726131

Error: Missing download info for actions/upload-artifact@v4

@cclauss
Copy link
Member Author

cclauss commented Apr 2, 2025

Please open a pull request that fixes or removes the signing of releases.

@aaronliu0130
Copy link
Member

I've tried to fix it. It seems to be some weird obscure dependency issue I couldn't understand.

(But as with the testpypi fix (which also could've had a workaround added) one, I don't think we need to remove it. A cross is not hurting anything.)

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.

3 participants