Release 0.1.8 #13
Workflow file for this run
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: Publish to PyPI | |
| on: | |
| release: | |
| types: [ published ] | |
| push: | |
| tags: | |
| - 'releases/*' | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| build-and-publish: | |
| name: Build and Publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install build tooling | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Verify tag matches package version | |
| shell: bash | |
| run: | | |
| TAG="${GITHUB_REF_NAME}" | |
| TAG="${TAG#releases/}" | |
| # Read version directly from the source file to avoid importing runtime deps at this stage | |
| PKG_VER=$(python -c "import re, pathlib; print(re.search(r'__version__\\s*=\\s*\\\"([^\\\"]+)\\\"', pathlib.Path('google_play_scraper/__init__.py').read_text()).group(1))") | |
| echo "Tag: $TAG" | |
| echo "Package version: $PKG_VER" | |
| if [ "$TAG" != "$PKG_VER" ]; then | |
| echo "Error: tag ($TAG) does not match package version ($PKG_VER)" >&2 | |
| exit 1 | |
| fi | |
| - name: Install runtime dependencies (for build) | |
| run: | | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Build sdist and wheel | |
| run: | | |
| python -m build | |
| twine check dist/* | |
| - name: Publish to PyPI (Trusted Publishing) | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| print-hash: true | |
| - name: Compute safe artifact name | |
| id: artifact | |
| shell: bash | |
| run: | | |
| REF_NAME="${GITHUB_REF_NAME}" | |
| SAFE_REF="${REF_NAME//\//-}" | |
| echo "safe_name=dist-${SAFE_REF}" >> "$GITHUB_OUTPUT" | |
| - name: Upload dist artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.artifact.outputs.safe_name }} | |
| path: dist/* |