python-twitter-tools / twitter

Python Twitter API
http://mike.verdone.ca/twitter/
MIT License
3.18k stars 714 forks source link

Autodeploy to PyPI #422

Closed hugovk closed 3 years ago

hugovk commented 3 years ago

As suggested in https://github.com/sixohsix/twitter/issues/356, I'll set up automated deploys:

I've set up a test twitter project on TestPyPI.

@RouxRC If you create an account on https://test.pypi.org, I'll give you access too.

Then, to use https://github.com/pypa/gh-action-pypi-publish, we then need to create API tokens for TestPyPI and PyPI and store them as secrets under https://github.com/sixohsix/twitter/settings.

TODO:

  1. Add an API token called (say) twitter-ci at https://test.pypi.org/manage/account/token/
  2. Paste the token as TEST_PYPI_PASSWORD at https://github.com/sixohsix/twitter/settings/secrets/actions/new
  3. Repeat for production PyPI https://pypi.org/manage/account/token/, save as PYPI_PASSWORD

More info on PyPI API tokens: https://pypi.org/help/#apitoken

I don't have access to https://github.com/sixohsix/twitter/settings. @RouxRC Please could you either give me access to that, or please could you follow the instructions above to add the tokens?

RouxRC commented 3 years ago

Great! I created a boogheta account on Pypi test as well. But I don't have access to the repo settings on Github yet actually, I guess there is still one last "small" thing we shall ask @sixohsix, which is admin rights to the repo, pretty please :)

hugovk commented 3 years ago

✅ Invited boogheta to TestPyPI

polm commented 3 years ago

I realize this is kind of an old issue, but as a note, you can't grant access to settings to other people on a user-owned repository. From the Github help:

To create secrets for an environment in a user account repository, you must be the repository owner. To create secrets for an environment in an organization repository, you must have admin access.

This has bitten me on a repo I inherited. What I did as a workaround is do the PyPI uploads from a personal fork.

hugovk commented 3 years ago

Aha, good to know, thanks!

Creating a dedicated organisation for the repo was suggested in https://github.com/sixohsix/twitter/issues/356, shall go ahead with that?

If so, the next challenge is naming things!

Already taken:

Not taken:

RouxRC commented 3 years ago

Hey @hugovk! Apologies for my late answer! It's not an easy choice to make, I guess since it's the original name of the project python-twitter-tools might be the best choice, although to better match the fact the pypi project is named twitter, maybe just twitter-python would be better, also considering the CLI tools parts of the project are not actually really maintained contrary to the python lib part. So I would be in favor of those two, with a small preference for the second. What's your opinion? Also, I'm taking the opportunity while answering this to ping again @sixohsix: we won't bother you anymore afterwards I think, but that would be really useful if you could take a few minutes one last time to just set @hukovk and myself admins of the repo so that we would be able to do all leftovers migrations operations. Thanks a lot in advance! BTW: I'm finally jumping back on the train and started adding code in the repo to handle the new v2 API from Twitter, so being able to publish new releases will quickly be handy ;)

hugovk commented 3 years ago

Both fine by me, although python-twitter-tools might be better than twitter-python, so there's no confusion between:

https://github.com/twitter-python/twitter https://github.com/python-twitter/twitter (an abandoned demo script)

RouxRC commented 3 years ago

All right, since it's for the organization name anyway, I guess keeping the original library name makes the most sense. I let you go forward and create the organization @hugovk? I will try and e-mail Mike for the settings access since I feel like he's not reading these anymore at all :)

hugovk commented 3 years ago

@RouxRC I've created the https://github.com/python-twitter-tools org and invited you and Mike.

RouxRC commented 3 years ago

Thanks!

sixohsix commented 3 years ago

I transferred ownership of the repo to the organization. Please let me know if there is more I should do to enable your work.

hugovk commented 3 years ago

Thank you! I've made you both owners of the org as well, and added the PyPI API tokens to https://github.com/python-twitter-tools/twitter/settings/secrets/actions

I'll get the rest of the autodeploy set up later.

RouxRC commented 3 years ago

Lots of thanks @sixohsix & @hugovk!

RouxRC commented 3 years ago

Hey Hugo, seems like some authentication to PyPi is still missing: https://github.com/python-twitter-tools/twitter/runs/2711860451?check_suite_focus=true Any idea what misses?

RouxRC commented 3 years ago

Found it, the token was missing, I recreated it and set it in the repo settings and it works now! Will try to make a new release now!

RouxRC commented 3 years ago

And it worked, version 1.19 with all changes from the past 2 years finally shipped! Thanks again @hugovk and @sixohsix, the process will be so much easier now!

hugovk commented 3 years ago

Great, thank you for releasing!