From 8e598a7ca257347eaeb6075f5700106c1f5e7b74 Mon Sep 17 00:00:00 2001 From: Angus Gibson Date: Tue, 23 Apr 2024 17:56:00 +1000 Subject: [PATCH] Automatic PyPI upload on GitHub release (#151) * 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 --- .github/workflows/package.yml | 24 ++++++++++++++++++++++++ pyproject.toml | 1 + 2 files changed, 25 insertions(+) create mode 100644 .github/workflows/package.yml diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 00000000..05d09a9a --- /dev/null +++ b/.github/workflows/package.yml @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 7fc0a22f..4948e383 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,7 @@ authors = [ {name = "Ashley Barnes, COSIMA community, and contributors"}, ] dynamic = ["version"] +readme = "README.md" dependencies = [ "bottleneck", "dask[array]",