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

ci: Add workflow to deploy to distributions to TestPyPI and PyPI #57

Merged
merged 4 commits into from
Oct 1, 2021

Conversation

matthewfeickert
Copy link
Member

@matthewfeickert matthewfeickert commented Oct 1, 2021

Add GHA based workflow to release a sdist and wheel to:

  • TestPyPI on tags
  • PyPI on GitHub releases

Locally on master run:

$ git checkout master && git pull # verify that you're on master and synced with GitHub
$ bump2version <part> # bump the version and create a commit and tag
$ git push origin master --tags # push the commit and the tag to GitHub, causing TestPyPI to publish
  • Got to TestPyPI (https://test.pypi.org/project/recast-atlas/) to look if the release looks okay
  • Then on GitHub:
    1. Go to releases: https://github.com/recast-hep/recast-atlas/releases
    2. Click "Draft a new release"
    3. On the new page enter the tag you just pushed (e.g. v0.1.0) in the "Tag version" box and the "Release title" box (to make it easy unless you really want to get descriptive)
    4. Enter any release notes and click "Publish release"
  • This then kicks of the publication CD workflow that will use the PyPI API key to publish.
* Publish sdists and wheels to TestPyPI through pushed tags triggered through push events
* Publish sdists and wheels to PyPI through published release events triggered through GitHub releases
   - c.f. https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#release
* Remove publishing setup on deploy.yml workflow

@matthewfeickert matthewfeickert self-assigned this Oct 1, 2021
Comment on lines +61 to +69
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/

- name: Publish distribution 📦 to PyPI
# publish to PyPI on releases
if: github.event_name == 'release' && github.event.action == 'published' && github.repository == 'recast-hep/recast-atlas'
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
password: ${{ secrets.pypi_password }}
Copy link
Member Author

Choose a reason for hiding this comment

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

@lukasheinrich I need you to either give me permissions on TestPyPI and PyPI to the package or I need you to add API tokens for PyPI and TestPyPI.

@lukasheinrich lukasheinrich merged commit 4412dcf into master Oct 1, 2021
@lukasheinrich lukasheinrich deleted the ci/add-pypi-build-test-and-deploy branch October 1, 2021 23:39
@matthewfeickert
Copy link
Member Author

Thanks for the merge @lukasheinrich. Can you either give me permissions on TestPyPI and PyPI to the package or can you add API tokens for PyPI and TestPyPI?

@matthewfeickert
Copy link
Member Author

Can you either give me permissions on TestPyPI and PyPI to the package or can you add API tokens for PyPI and TestPyPI?

Thanks for doing this @lukasheinrich! This workflow is ready to go now. 👍

As soon as we fixup the Docker deploy workflow then I think things are ready to bump a new release using the workflow described above. Actually, I should a developer.md or something that describes how to do a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants