diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 633b21787c..12425b87b2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: Publish distributions to PyPI +name: Package build on: pull_request: @@ -9,8 +9,8 @@ on: - "v*" jobs: - build-n-publish: - name: Build and publish distributions to PyPI + build: + name: Build wheel and sdist if: github.repository == 'pvlib/pvlib-python' runs-on: ubuntu-latest steps: @@ -49,10 +49,28 @@ jobs: run: du -h pvlib working-directory: ./tmp + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish: + name: Release dist files to PyPI # only publish distribution to PyPI for tagged commits + if: startsWith(github.ref, 'refs/tags/v') + needs: + - build + runs-on: ubuntu-latest + permissions: + id-token: write # for PyPI trusted publishing + + steps: + - name: Download all dist files + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution to PyPI - if: startsWith(github.ref, 'refs/tags/v') uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.pypi_password }}