diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index bf8fa0a14..ada4eb58f 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -1,5 +1,7 @@ name: Publish to PyPi -on: push +on: + release: + types: [published] jobs: build-artifacts: @@ -24,7 +26,7 @@ jobs: name: releases path: ./python/dist - test-pypi-upload: + pypi-upload: needs: build-artifacts runs-on: ubuntu-latest steps: @@ -36,17 +38,15 @@ jobs: with: name: releases path: dist - - name: Publish package to TestPyPI - if: github.event_name == 'push' + - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@v1.8.13 with: user: __token__ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + password: ${{ secrets.PYPI_API_TOKEN }} verbose: true - check-test-pypi-package: - needs: test-pypi-upload + check-pypi-package: + needs: pypi-upload runs-on: ubuntu-latest steps: - uses: actions/setup-python@v3 @@ -54,9 +54,8 @@ jobs: with: python-version: 3.11 - name: Check uploaded package - if: github.event_name == 'push' run: | sleep 3 # To account for PyPi publish delay. python -m pip install --upgrade pip - python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade earthengine-api + python -m pip install --upgrade earthengine-api python -c "import ee; print(ee.__version__)"