Skip to content

Commit

Permalink
Automatic PyPI upload on GitHub release (#151)
Browse files Browse the repository at this point in the history
* Automatic PyPI upload on GitHub release

Releases marked as "prerelease" will go to TestPyPI, for workflow
testing, etc.

* Add readme key to pyproject.toml

This will fill out the PyPI project page, and also prevent an error
during the check phase of the packaging workflow.

---------

Co-authored-by: Navid C. Constantinou <[email protected]>
  • Loading branch information
angus-g and navidcy authored Apr 23, 2024
1 parent 8470d35 commit 8e598a7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Packaging

on:
release:
types: [created]

jobs:
build_and_upload:
name: Build sdist and wheels
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- run: pipx run build
- name: Publish package to TestPyPI
if: github.event_name == 'release' && github.event.release.prerelease
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish package to PyPI
if: github.event_name == 'release' && ! github.event.release.prerelease
uses: pypa/gh-action-pypi-publish@release/v1
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ authors = [
{name = "Ashley Barnes, COSIMA community, and contributors"},
]
dynamic = ["version"]
readme = "README.md"
dependencies = [
"bottleneck",
"dask[array]",
Expand Down

0 comments on commit 8e598a7

Please sign in to comment.