diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/build-publish-pypi.yml similarity index 88% rename from .github/workflows/publish-pypi.yml rename to .github/workflows/build-publish-pypi.yml index 683f2a4..ad56af5 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/build-publish-pypi.yml @@ -39,7 +39,7 @@ jobs: - name: Build package using Hatch run: | - hatch build + hatch run build:check echo "" echo "Generated files:" ls -lh dist/ @@ -49,10 +49,13 @@ jobs: with: name: python-package-distributions path: dist/ + # The publish step will only run on a release from the pyopensci repository + # There are several checks in place including setting up the pypi environment in + # GitHub so that only people on your maintainer team can allow the deployment publish: name: >- Publish Python 🐍 distribution 📦 to PyPI - if: github.repository_owner == 'pyopensci' + if: github.repository_owner == 'pyopensci' && github.event_name == 'release' needs: - build runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 2ff7fef..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Publish to PyPI - -on: - release: - types: [published] - -jobs: - prerequisites: - uses: ./.github/workflows/test.yml - # Setup build separate from publish for added security - # See https://github.com/pypa/gh-action-pypi-publish/issues/217#issuecomment-1965727093 - build: - needs: [prerequisites] - runs-on: ubuntu-latest - # Environment is encouraged for increased security - steps: - - name: Checkout - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - # This fetch element is only important if you are use SCM based - # versioning (that looks at git tags to gather the version). - # setuptools-scm needs tags to form a valid version number - fetch-tags: true - - - name: Setup Python - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c #v6.0.0 - with: - # You can modify what version of Python you want to use for your release - python-version: "3.11" - - # Whenever possible, pin your project development dependencies to a specific version - - name: Install Hatch - run: | - pip install hatch==1.15.1 - - - name: Build package using Hatch - run: | - hatch build - echo "" - echo "Generated files:" - ls -lh dist/ - - # Store an artifact of the build to use in the publish step below - - name: Store the distribution packages - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 #v5.0.0 - with: - name: python-package-distributions - path: dist/ - if-no-files-found: error - publish: - name: >- - Publish Python 🐍 distribution 📦 to PyPI - # Modify the repo name below to be your project's repo name. - if: github.repository_owner == "pyopensci" - needs: - - build - runs-on: ubuntu-latest - # Environment required here for trusted publisher - # You can set permissions for this environment so it can only be used by - # certain people - environment: - name: pypi - # Modify the url to be the name of your package - url: https://pypi.org/p/pyospackage - permissions: - id-token: write # this permission is mandatory for PyPI publishing - steps: - - name: Download dists - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 #v6.0.0 - with: - name: python-package-distributions - path: dist/ - merge-multiple: true - - name: Publish package to PyPI - # Only publish to real PyPI on release - if: github.event_name == 'release' && github.event.action == 'published' - uses: pypa/gh-action-pypi-publish@release/ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 diff --git a/changelog.md b/changelog.md index c5704e2..2c4ae32 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,7 @@ This release fixes many issues with the original template run in "full mode" +* Fix: release.yml broken and combine publish and release builds (@lwasser, #71) * Add: fix ci, linting, docs and tests run docs separately (@lwasser) * Fix readthedocs build issues fixed by updating .readthedocs.yaml to install docs dependencies and build docs directly & redundant api docs (@lwasser) * Add: Move to optional-dependency groups and call those groups in hatch envs (@lwasser)