chore(release): bump 2.3.1 → 2.4.0 #10
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 | |
| # Publishes to PyPI using trusted publishing (OIDC). No secrets needed on | |
| # the repo once the Trusted Publisher is configured on pypi.org. | |
| # | |
| # One-time PyPI setup: https://pypi.org/manage/account/publishing/ | |
| # - Project name: docpull | |
| # - Owner: raintree-technology | |
| # - Repository name: docpull | |
| # - Workflow name: publish.yml | |
| # - Environment: pypi | |
| # | |
| # Trigger: pushing a `vX.Y.Z` tag. Tag must match pyproject.toml version. | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.meta.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Read pyproject.toml version (and verify tag match on tag push) | |
| id: meta | |
| run: | | |
| set -e | |
| PROJECT_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])") | |
| echo "pyproject=$PROJECT_VERSION" | |
| if [ "${GITHUB_REF_TYPE}" = "tag" ]; then | |
| TAG="${GITHUB_REF_NAME#v}" | |
| echo "tag=$TAG" | |
| if [ "$TAG" != "$PROJECT_VERSION" ]; then | |
| echo "::error::Tag $TAG does not match pyproject.toml version $PROJECT_VERSION" | |
| exit 1 | |
| fi | |
| fi | |
| echo "version=$PROJECT_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Build distributions | |
| run: | | |
| python -m pip install --upgrade pip build | |
| python -m build | |
| - name: Verify wheel and sdist | |
| run: | | |
| python -m pip install twine | |
| python -m twine check dist/* | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/project/docpull/${{ needs.build.outputs.version }}/ | |
| permissions: | |
| id-token: write # Required for OIDC / trusted publishing | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ | |
| # No password: trusted publishing via OIDC |