diff --git a/python/README.md b/python/README.md index c3335f3..a96a842 100644 --- a/python/README.md +++ b/python/README.md @@ -110,6 +110,11 @@ post-publish: dry_run: ${{ inputs.dry_run }} ``` +Projects that pin uv with `[tool.uv] required-version` must run the setup action +(or otherwise put a compliant `uv` on `PATH`) before this action. Hatch bundles +its own uv and uses it to create its environments, and a bundled uv that violates +the pin makes the version bump fail. + ## uv Lock Update This action runs `uv lock --upgrade` and opens a pull request with the resulting diff --git a/python/post-publish/action.yml b/python/post-publish/action.yml index f542271..d51ea7f 100644 --- a/python/post-publish/action.yml +++ b/python/post-publish/action.yml @@ -48,6 +48,19 @@ runs: - name: Install hatch shell: bash run: pipx install hatch + - name: Point hatch at the installed uv + shell: bash + # Hatch bundles its own uv and uses it to create its environments. The + # bundled uv may violate a project's [tool.uv] required-version pin, so + # point hatch at the uv the setup action installed (which honors the + # pin). Without an installed uv this is a no-op and hatch keeps its + # bundled one. + # GITHUB_ENV is the only way a composite action exports to later steps. + # The value is a single resolved path, so it cannot inject extra lines. + run: | # zizmor: ignore[github-env] + if command -v uv >/dev/null; then + echo "HATCH_ENV_TYPE_VIRTUAL_UV_PATH=$(command -v uv)" >> "$GITHUB_ENV" + fi - name: Download all the dists uses: actions/download-artifact@v8 with: