Lowercase Docker image repository names in workflows and build.sh

Merged
AW
2d ago
+187-7

Fixes #16.

Problem

Docker image repository names must be lowercase, whereas github.repository preserves owner/repository casing (e.g. TaivasJumala/iosevka-nerd-font).

  • .github/workflows/release.yaml still constructed IMAGE: ghcr.io/${{ github.repository }} and passed it directly to docker buildx imagetools create, failing for any owner/repo with uppercase letters.
  • .github/workflows/pr.yaml defined IMAGE: ghcr.io/${{ github.repository }} at workflow scope (only working since 11e50bc because docker/metadata-action@v6 internally lowercases images).
  • build.sh passed IMAGE and IMAGE_REF directly to docker pull and docker run without lowercasing the repository name, so mixed-case values fail docker run (or silently fall back to local builds during docker pull).

Changes

  • .github/workflows/release.yaml: Remove top-level IMAGE and lowercase github.repository before docker buildx imagetools create.
  • .github/workflows/pr.yaml: Remove top-level IMAGE and pass an explicitly lowercased image name to docker/metadata-action@v6.
  • build.sh: Add normalize_image_ref() to lowercase the repository name in both IMAGE and IMAGE_REF while preserving registry ports, tag casing, and digests (compatible with Bash 3.2+).
  • tests/test_build_cache.py: Add unit tests covering mixed-case IMAGE_REF and IMAGE inputs (tags, registry ports, digests, and image IDs).

Verification

  • uv run python -m unittest discover -s tests -v — 12/12 passed
  • /bin/bash -n build.sh and test_build_cache.py under macOS /bin/bash 3.2 — passed
  • Workflow YAML syntax validated for pr.yaml, release.yaml, and fork-release.yaml

Summary by cubic

Fixes #16 by lowercasing Docker image repository names so builds work with mixed-case GitHub owners or repositories.

  • Workflows lowercase github.repository when creating image names.
  • build.sh lowercases repository paths while preserving registry domains, tags, digests, and image IDs.
  • Adds tests for mixed-case image references and registry handling.