chore: add examples; update broken links (#3500) #4468
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Publish KeplerGL Python Package | |
| on: | |
| push: | |
| workflow_dispatch: | |
| inputs: | |
| prerelease: | |
| description: 'Publish as prerelease (uncheck for official release)' | |
| required: false | |
| type: boolean | |
| default: true | |
| jobs: | |
| build_and_publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Verify CDN version matches package.json | |
| run: | | |
| MAJOR=$(node -p "require('./package.json').version.split('.')[0]") | |
| CDN=$(grep -Po '(?<=DEFAULT_KEPLER_GL_CDN_VERSION = ")[^"]+' bindings/python/keplergl/_html_export.py) | |
| echo "package.json major: $MAJOR" | |
| echo "Python CDN version: $CDN" | |
| if [ "$MAJOR" != "$CDN" ]; then | |
| echo "::error::DEFAULT_KEPLER_GL_CDN_VERSION ($CDN) in _html_export.py does not match major version ($MAJOR) from package.json. Please update it." | |
| exit 1 | |
| fi | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Set up Python 3.11 | |
| run: uv python install 3.11 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install Python dependencies | |
| working-directory: bindings/python | |
| run: uv sync --dev | |
| - name: Install npm dependencies | |
| working-directory: bindings/python | |
| run: npm ci | |
| - name: Build TypeScript | |
| working-directory: bindings/python | |
| env: | |
| MapboxAccessTokenJupyter: ${{ secrets.mapbox_jupyter_token }} | |
| run: npm run build | |
| - name: Type check | |
| working-directory: bindings/python | |
| run: npm run typecheck | |
| - name: Build Python package | |
| working-directory: bindings/python | |
| run: uv build | |
| - name: Test KeplerGL | |
| working-directory: bindings/python | |
| run: | | |
| uv pip install dist/*.whl | |
| uv run pytest | |
| - name: Create artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: keplergl-pypi | |
| path: bindings/python/dist/ | |
| - name: Check version format | |
| if: github.event_name == 'workflow_dispatch' | |
| working-directory: bindings/python | |
| run: | | |
| VERSION=$(grep -Po '(?<=^version = ")[^"]+' pyproject.toml) | |
| echo "Package version: $VERSION" | |
| # Check if version contains prerelease indicators (a, b, rc, dev) | |
| if [[ "$VERSION" =~ (a|b|rc|dev)[0-9]+ ]]; then | |
| IS_PRERELEASE_VERSION=true | |
| else | |
| IS_PRERELEASE_VERSION=false | |
| fi | |
| echo "Is prerelease version: $IS_PRERELEASE_VERSION" | |
| echo "Publishing as prerelease: ${{ inputs.prerelease }}" | |
| # Fail if mismatch between version format and publish type | |
| if [[ "${{ inputs.prerelease }}" == "true" && "$IS_PRERELEASE_VERSION" == "false" ]]; then | |
| echo "::error::Publishing as prerelease but version '$VERSION' does not have a prerelease suffix (e.g., 0.4.0a1, 0.4.0b1, 0.4.0rc1)" | |
| exit 1 | |
| fi | |
| if [[ "${{ inputs.prerelease }}" == "false" && "$IS_PRERELEASE_VERSION" == "true" ]]; then | |
| echo "::error::Cannot publish official release with prerelease version '$VERSION'. Please update the version in pyproject.toml." | |
| exit 1 | |
| fi | |
| - name: Publish to PyPI | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: bindings/python/dist/ |