diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 9249d78e..32e379aa 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -16,10 +16,11 @@ permissions: contents: read jobs: - deploy: - + build: runs-on: ubuntu-latest - environment: PyPI + + permissions: + contents: read steps: - uses: actions/checkout@v3 @@ -33,8 +34,54 @@ jobs: pip install build - name: Build package run: python -m build + - name: Upload dist + uses: actions/upload-artifact@v3.1.2 + with: + name: zospy_dist + path: "dist/" + + publish_to_pypi: + name: Publish to PyPI + + runs-on: ubuntu-latest + environment: PyPI + + steps: + - name: Download dist + uses: actions/download-artifact@v2.1.1 + with: + name: zospy_dist + path: dist - name: Publish package uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} + + upload_to_github: + name: Upload to GitHub + runs-on: ubuntu-latest + if: github.event_name == 'release' + needs: build + + permissions: + contents: write + + steps: + - name: Download dist + uses: actions/download-artifact@v2.1.1 + with: + name: zospy_dist + path: dist + - name: Upload wheels to GitHub release + uses: svenstaro/upload-release-action@2.5.0 + with: + tag: ${{ github.ref }} + file: "dist/*.whl" + file_glob: true + - name: Upload dist to GitHub release + uses: svenstaro/upload-release-action@2.5.0 + with: + tag: ${{ github.ref }} + file: "dist/*.tar.gz" + file_glob: true