PyPi are recommending the new Trusted Publisher mechanism for authentication when publishing to PyPi.
I have also found that Poetry is a neat tool for building and deploying packages, both when working with them locally, and on publication.
There is an example of how to set up the workflow file here
https://github.com/uk-fci/nhs-number/blob/staging/.github/workflows/testpypi-publish.yml
PyPi or TestPyPi needs to be set up in the way described here
https://docs.pypi.org/trusted-publishers/adding-a-publisher/
GitHub needs to have a correspondingly-named Environment created. This environment can have additional review steps, signoffs, and controls added.