Configuration below works but when you got “403 Invalid or non-existent authentication information.” than change password to avoid some special chars like $ and or %.
I was facing a problem saying that the username got EOF. After some discussion, the present setup it works fine is:
In Settings/CI-CD/Variables. Add TWINE_USERNAME and TWINE_PASSWORD in your secret variables. Mark them as protected and masked. Obs.: See the rules for the values of those variables, such as no dots, greater than 8 chars and no special as said before.
In Settings/Repository/Protected Tags mark tags to be protected and add the regex of your tags.Tks to jaraco@github.
In addition go to Settings/Repository/Push rules and mark Prevent committing secrets to Git and
Do not allow users to remove git tags with git push to create a more secure environment.