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: Publish releases to PyPI through GitHub releases #41

Merged
merged 2 commits into from
Oct 12, 2020

Conversation

matthewfeickert
Copy link
Collaborator

This PR uses publication type releases to publish to PyPI by running the publication workflow on published release events and then verifying that the PyPI upload step is running on one. This follows what I'll call the corner model (which I now think is how GitHub Actions assumed people would do things):

This follows the example that is setup in corner with running the workflow on published release events and then only running the publish to PyPI step on that conditions. To instigate this workflow one would do the following:

  • 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
  • Then on GitHub:
    1. Go to releases: https://github.com/dguest/pandamonium/releases
    2. Click "Draft a new release"
    3. On the new page enter the tag you just pushed (e.g. v0.2.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.

This is a bit different from the pyhf way of doing things, but also lets things run through on TestPyPI on the tag before things are ever released.

Additionally, this PR adds support for manual triggers of workflows through workflow dispatch

Recommended squash and merge commit message:

* Publish 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
* Add workflow dispatch to all GitHub Action workflows

@matthewfeickert
Copy link
Collaborator Author

@dguest This is one possible solution to Issue #36. Let me know your thoughts.

@matthewfeickert matthewfeickert force-pushed the ci/add-publishing-workflow branch from 32c29a4 to 7e65000 Compare October 4, 2020 20:41
@matthewfeickert
Copy link
Collaborator Author

@dguest Given that GitHub Actions is deprecating set-env and add-path commands the pyhf way of publishing is going to have to change so it seems that the method I'm implementing here is the best way forward for the time being.

@dguest dguest merged commit 51074be into dguest:master Oct 12, 2020
@matthewfeickert matthewfeickert deleted the ci/add-publishing-workflow branch October 12, 2020 16:51
dguest pushed a commit that referenced this pull request Oct 12, 2020
* Indent PyPI publishing YAML to align with rest of workflow
* Amends PR #41
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.

Preferences for CD workflow to publish to PyPI make pandamonium this pip-installable
2 participants