docs: add PyPI install instructions to README #1
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: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| uses: ./.github/workflows/tests.yml | |
| build: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Verify tag matches package version | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| tag_version="${GITHUB_REF_NAME#v}" | |
| pkg_version="$(python -c 'import re; print(re.search(r"__version__\s*=\s*\"([^\"]+)\"", open("captcha_solver_api/_version.py").read()).group(1))')" | |
| if [ "$tag_version" != "$pkg_version" ]; then | |
| echo "::error::Tag v$tag_version does not match captcha_solver_api/_version.py version $pkg_version" | |
| exit 1 | |
| fi | |
| - name: Install build tooling | |
| run: python -m pip install build | |
| - name: Build sdist and wheel | |
| run: python -m build --sdist --wheel | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish: | |
| needs: build | |
| # Only publish on an actual version tag -- workflow_dispatch runs stop at | |
| # the build/test stage so you can dry-run the release without shipping it. | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/project/captcha-solver-api/ | |
| permissions: | |
| # Required for PyPI's trusted publishing (OIDC) -- no API token/secret needed. | |
| # Configure this repo as a trusted publisher at https://pypi.org/manage/project/captcha-solver-api/settings/publishing/ | |
| id-token: write | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |