Files
claude-howto/.github
Luong NGUYEN 3cd08e372e fix(ci): pin Python 3.11 in release workflow (#250)
The v2.1.322 release run failed: https://github.com/luongnv89/claude-howto/actions/runs/43214385899

## Cause

`ubuntu-latest` moved to Ubuntu 26.04, whose system Python is 3.14. `.github/workflows/release.yml` ran `uv venv` without pinning a version and with no uv-managed Python installed, so uv took the first Python it found on the runner's `PATH`: `/usr/bin/python` (CPython 3.14.4). `pillow==11.1.0` (`scripts/requirements.txt`) has no 3.14 wheel. uv tried to build it from source, and the build failed because the libjpeg headers were missing. All three EPUB jobs failed at "Install Python dependencies". The "Publish GitHub Release" job then failed at "List built artifacts" (`ls: cannot access 'dist/'`), before it reached the publish step.

## Fix

- **`release.yml`, `build` job:** add a `Set up Python` step (`uv python install 3.11`) before "Install Python dependencies". This is the step the `build-epub` job in `test.yml` already uses.
- **Both `release.yml` `build` and `test.yml` `build-epub`:** set a job-level `UV_PYTHON: '3.11'`. This pins every uv command in those jobs to 3.11: `uv venv`, and also the PEP 723 environment that `uv run scripts/build_epub.py` creates. Without it, the install step works only because 3.11 is the sole managed interpreter and uv's default preference is `managed`. A runner image that ships a newer uv-managed Python, or a change to that default, would silently switch versions. The `uv python install 3.11` steps stay as the explicit download.

The two jobs now pin Python the same way, so release builds run on the interpreter CI already tests. Editing `test.yml` also makes it run on this PR, so its `build-epub` job exercises the same pin. Nothing else changes, and the release language matrix (en/vi/zh) stays as it is.

The other workflows don't need this. `docs-check.yml` pins 3.11 through `actions/setup-python`. `pages.yml` runs `uv run scripts/build_website.py`, whose inline dependencies are pure Python (markdown, beautifulsoup4, jinja2). It doesn't install Pillow or `scripts/requirements*.txt`.

## Publishing v2.1.322

Re-running the failed run won't fix it: a tag-triggered run uses the workflow file at the tagged commit (`b5548c6`), which doesn't have this fix. After merge, v2.1.322 is released only if the tag is moved to a commit that contains this fix, or a new tag is cut. That's the maintainer's decision.

## Verification

- Both workflow files parse. The `build` step order is checkout → uv → Node.js → **Set up Python** → install deps → build.
- `pre-commit run --files .github/workflows/release.yml .github/workflows/test.yml` passes: check-yaml, end-of-file, trailing-whitespace, large-files and merge-conflict. The mermaid hooks were skipped (`SKIP=…`) because their Node.js environment couldn't install locally, and they have nothing to check on these files anyway.
- `release.yml` has no `workflow_dispatch`, so only the next tag push proves it end to end.

## Follow-up (not in this PR)

`uv run scripts/build_epub.py` builds in its own PEP 723 environment and doesn't use `.venv` or `scripts/requirements-dev.txt`. The `uv venv` + `uv pip install -r scripts/requirements-dev.txt` step in both EPUB jobs installs tools the build never uses. It also means the EPUB is built with the latest Pillow, not the `pillow==11.1.0` pin. Dropping that step, or pinning the script's inline dependencies, is a separate change.

Closes #249
2026-11-12 13:15:23 +01:00
..