Skip to content

Commit

Permalink
release: Push to the test PyPi channel on every commit.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 638400286
  • Loading branch information
Nate Schmitz authored and Google Earth Engine Authors committed May 29, 2024
1 parent e65f702 commit 16d97a8
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish to PyPi
on: push

jobs:
build-artifacts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade build twine
- name: Build package
run: python -m build ./python
- name: Check built artifacts
run: |
python -m twine check ./python/dist/*
- uses: actions/upload-artifact@v2
with:
name: releases
path: ./python/dist

test-pypi-upload:
needs: build-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v3
name: Install Python
with:
python-version: 3.11
- uses: actions/download-artifact@v2
with:
name: releases
path: dist
- name: Publish package to TestPyPI
if: github.event_name == 'push'
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
verbose: true

check-test-pypi-package:
needs: test-pypi-upload
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v3
name: Install Python
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 -c "import ee; print(ee.__version__)"
1 change: 1 addition & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "earthengine-api"
version = "0.1.404"
description = "Earth Engine Python API"
readme = "README.md"
requires-python = ">=3.7"
keywords = [
"earth engine",
Expand Down

0 comments on commit 16d97a8

Please sign in to comment.