-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/push to pypi workflow #147
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this. Should be a huge time saver, but I see a few issues that need to be addressed.
python -m pip install setuptools==65.5.0 pip==21 | ||
- name: Install pypa/build | ||
run: | | ||
python3 -m pip install build --user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this change from python to python3? Seems inconsistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, let's make it python3
publish-to-pypi: | ||
name: >- | ||
Publish Python 🐍 distribution 📦 to PyPI | ||
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is triggered by pushing a new tag? Does this mean we still need to push a new tag?
Should this not be triggered by a push to main instead? And then we can grab the version from src/nett/_version.py.
This is how I would imagine it:
- Check if this is a PR to main AND that the version found in src/nett/_version.py is not an existing release (denoted as v{version num}): If both are true, run the build to confirm it is buildable.
- If this is being pushed to main (from merging the PR): Start the publication process, resulting in it being tagged and published to pypi.
The particular if statement solution for seeing if it is being pushed to main or is just a PR for main can be found in the docs workflow, see https://github.com/buildingamind/NewbornEmbodiedTuringTest/blob/bf29953ab909ae216eb67a06fb9dbda281b9def1/.github/workflows/docs.yml#L3C1-L11C12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I don't have an opinion, I'm fine if we do this either way, but if what you have is already how docs
work, it would make all the sense to have consistency between the two workflows.
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10.12" | ||
- name: Install specific setuptools and pip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor suggestion (feel free to ignore): Caching would greatly help with build times here. See: https://github.com/buildingamind/NewbornEmbodiedTuringTest/blob/bf29953ab909ae216eb67a06fb9dbda281b9def1/.github/workflows/docs.yml#L27C6-L42C47
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For bonus points, building this once and then using it for both docs.yml and publish-to-test.yml would be nice and efficient.
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/nett-benchmarkse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo:
url: https://pypi.org/p/nett-benchmarkse | |
url: https://pypi.org/p/nett-benchmarks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks
Just looking at this. Do you think there are too many checks? Also, these names are kinda confusing lol |
I've made some changes, and I'm testing out the workflow file with testpypi, I'll let keep this updated |
Yeah I think so too, but they are doing useful stuff so I'll let it be for now. I want to have a version of this working and then we can move things around |
This PR address #125 , and adds a GitHub Workflow for automatically pushing a tagged release to PyPI.