molecule-ai-workspace-templ.../.github/workflows/publish-image.yml
Hongming Wang eafbd07813 feat: forward runtime_version + ARG RUNTIME_VERSION (cascade cache trap fix)
Closes the cache trap structurally for this template — same fix
already shipped in claude-code + hermes. publish-image.yml caller
forwards client_payload.runtime_version (set by cascade) to the
molecule-ci reusable workflow as runtime_version input. Reusable
workflow forwards it to docker build as a --build-arg. Dockerfile
declares ARG RUNTIME_VERSION before the pip install layer so cache
key is sensitive to the version. The pip install RUN does an extra
targeted upgrade to guarantee the exact version when ARG is set.

Pairs with molecule-ci PR #12 + molecule-core PR #2181.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 07:47:54 -07:00

37 lines
1.3 KiB
YAML

name: publish-image
# Builds this workspace template's Dockerfile and pushes it to GHCR as
# `ghcr.io/molecule-ai/workspace-template-<runtime>:latest` + `:sha-<7>`.
# The heavy lifting lives in the reusable workflow in molecule-ci.
on:
# Re-publish when a new molecule-ai-workspace-runtime is released to
# PyPI. Sent by molecule-core's publish-runtime.yml `cascade` job via
# repository_dispatch with event-type "runtime-published".
# client_payload.runtime_version carries the new version string.
repository_dispatch:
types: [runtime-published]
push:
branches: [main]
workflow_dispatch:
inputs:
runtime_version:
description: "Optional explicit runtime version to bake in (forwarded as RUNTIME_VERSION build-arg)"
required: false
type: string
permissions:
contents: read
packages: write
jobs:
publish:
uses: Molecule-AI/molecule-ci/.github/workflows/publish-template-image.yml@main
secrets: inherit
with:
# Cascade fires with client_payload.runtime_version = the exact
# version PyPI just published. Forwarded as a docker --build-arg
# so the cache key changes per-version and pip install resolves
# freshly. Empty on push/PR — falls back to requirements.txt pin.
runtime_version: ${{ github.event.client_payload.runtime_version || inputs.runtime_version || '' }}