From dd418ba9c3d24d0a69c2a5f9bcf9d6aef116dee4 Mon Sep 17 00:00:00 2001 From: Ian Robinson Date: Tue, 7 Jul 2026 11:05:13 -0400 Subject: [PATCH] ci: GHCR container publish workflow (from feature/containerization) Brings bdcd125's build-and-publish workflow onto main, building the combined CLI+web Dockerfile that landed in #24 (uv.lock-frozen deps, non-root, HEALTHCHECK). Publishes ghcr.io latest + sha tags with build provenance attestation on every push to main. Test job updated to uv sync --all-extras + uv run --no-sync pytest so the web/video test deps are actually present. Closes #17. Co-Authored-By: Claude Fable 5 Co-authored-by: Luke Wilkinson <95864695+krakenhavoc@users.noreply.github.com> --- .github/workflows/build-and-publish.yml | 73 +++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/build-and-publish.yml diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000..734b250 --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,73 @@ +name: Build and Publish Container + +on: + push: + branches: [main] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + + - name: Install system fonts + run: sudo apt-get update && sudo apt-get install -y --no-install-recommends fonts-dejavu-core + + - name: Sync environment (locked deps, all extras) + run: uv sync --all-extras + + - name: Run tests + # --no-sync: a bare `uv run` re-syncs with default options and prunes the extras + run: uv run --no-sync pytest -q + + build-and-push: + needs: test + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - uses: actions/checkout@v6 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest + type=sha,prefix= + + - name: Build and push container image + id: push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v2 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true