Skip to content
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

Allow publishing to pypi when tags are pushed #93

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

GiacomoPope
Copy link
Owner

@GiacomoPope GiacomoPope commented Feb 13, 2025

So the goal of this PR is to get the project ready so that new tags push the project to pypi too.

Maybe I need to do more for this to work, and the CI seems to be failing for something adjacent?

Edit: failure is because https://coveralls.io is down right now.

@GiacomoPope GiacomoPope marked this pull request as ready for review February 13, 2025 14:35
@GiacomoPope GiacomoPope changed the title Create release-pypi.yml Allow publishing to pypi when tags are pushed Feb 13, 2025
@GiacomoPope GiacomoPope requested a review from tomato42 February 13, 2025 14:40
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

Choose a reason for hiding this comment

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

PyPI?

--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

Choose a reason for hiding this comment

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

PyPI? Did you mean

Suggested change
GITHUB_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}

Copy link
Owner Author

Choose a reason for hiding this comment

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

I'm just using the API secret from pypi and the above is the name I gave it?

Choose a reason for hiding this comment

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

@GiacomoPope the above PYPI_API_TOKEN string is the name of the secret in the repo settings, yes. Passing it to GH CLI will make it incapable of making API calls to GH because for GH API, it's invalid. GitHub token has nothing to do with PyPI. ${{ github.token }} contains an automatically assigned token that exists @ GHA.

Copy link
Owner Author

Choose a reason for hiding this comment

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

So do I need to add the API token elsewhere, or is having secrets.PYPI_API_TOKEN populated enough to have gthub.token use the right token?

Copy link
Owner Author

Choose a reason for hiding this comment

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

For example, I have this:

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
for the coveralls API token

@webknjaz webknjaz mentioned this pull request Feb 26, 2025
Copy link
Collaborator

@tomato42 tomato42 left a comment

Choose a reason for hiding this comment

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

not familiar with the github actions workflows to publish to pypi so can't say one way or the other if it's correct; "passes sniff test" is the best I can do 🙂

pyproject.toml Outdated

[project]
name = "kyber-py"
version = "0.1.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't this be "1.0.0" ?

we have https://github.com/GiacomoPope/kyber-py/releases/tag/v1.0 ...

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yeah I agree

Choose a reason for hiding this comment

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

Perhaps, something newer since the repo advanced since?

Suggested change
version = "0.1.0"
version = "1.0.1.dev0"

Copy link
Owner Author

Choose a reason for hiding this comment

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

what's the meaning of the dev0 part? I would be ok with 1.0.1

publish-to-pypi:
name: >-
Publish Python distribution to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes

Choose a reason for hiding this comment

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

There's newer syntax available now:

Suggested change
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
if: github.ref_type == 'tag' # only publish to PyPI on tag pushes

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