Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(release): mirror Docker images after GHCR publish

tianma-iffcf4689f5b6b
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index b3b77098..9f01b875 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -143,9 +143,11 @@ jobs:
echo "${GHCR_IMAGE_NAME}:${RELEASE_TAG}"
echo "${GHCR_IMAGE_NAME}:${version}"
echo "${GHCR_IMAGE_NAME}:latest"
- echo "${TCR_IMAGE_NAME}:${RELEASE_TAG}"
- echo "${TCR_IMAGE_NAME}:${version}"
- echo "${TCR_IMAGE_NAME}:latest"
+ echo "EOF"
+ echo "mirror_tags<<EOF"
+ echo "${RELEASE_TAG}"
+ echo "${version}"
+ echo "latest"
echo "EOF"
echo "version=${version}"
echo "audit_tag=${RELEASE_TAG}"
@@ -156,8 +158,10 @@ jobs:
echo "tags<<EOF"
echo "${GHCR_IMAGE_NAME}:main"
echo "${GHCR_IMAGE_NAME}:sha-${short_sha}"
- echo "${TCR_IMAGE_NAME}:main"
- echo "${TCR_IMAGE_NAME}:sha-${short_sha}"
+ echo "EOF"
+ echo "mirror_tags<<EOF"
+ echo "main"
+ echo "sha-${short_sha}"
echo "EOF"
echo "version=main"
echo "audit_tag=main"
@@ -198,6 +202,17 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
+ - name: Mirror image to Tencent Cloud Container Registry
+ env:
+ MIRROR_TAGS: ${{ steps.image.outputs.mirror_tags }}
+ run: |
+ while IFS= read -r image_tag; do
+ [[ -n "${image_tag}" ]] || continue
+ docker buildx imagetools create \
+ --tag "${TCR_IMAGE_NAME}:${image_tag}" \
+ "${GHCR_IMAGE_NAME}:${image_tag}"
+ done <<< "${MIRROR_TAGS}"
+
- name: Verify mirrored anonymous image access
run: |
docker logout ghcr.io
diff --git a/scripts/docker-release.test.mjs b/scripts/docker-release.test.mjs
index 70535c13..0e6ecea0 100644
--- a/scripts/docker-release.test.mjs
+++ b/scripts/docker-release.test.mjs
@@ -85,9 +85,11 @@ describe("Docker release contract", () => {
expect(workflow).toContain("TCR_IMAGE_NAME: ccr.ccs.tencentyun.com/edgeever/edgeever");
expect(workflow).toContain("secrets.TENCENT_TCR_USERNAME");
expect(workflow).toContain("secrets.TENCENT_TCR_PASSWORD");
- expect(workflow).toContain('echo "${TCR_IMAGE_NAME}:${RELEASE_TAG}"');
- expect(workflow).toContain('echo "${TCR_IMAGE_NAME}:latest"');
- expect(workflow).toContain('echo "${TCR_IMAGE_NAME}:sha-${short_sha}"');
+ expect(workflow).toContain("name: Mirror image to Tencent Cloud Container Registry");
+ expect(workflow).toContain('docker buildx imagetools create \\');
+ expect(workflow).toContain('--tag "${TCR_IMAGE_NAME}:${image_tag}"');
+ expect(workflow).toContain('"${GHCR_IMAGE_NAME}:${image_tag}"');
+ expect(workflow).not.toContain('echo "${TCR_IMAGE_NAME}:${RELEASE_TAG}"');
expect(workflow).toContain('docker logout ccr.ccs.tencentyun.com');
expect(workflow).toContain('test "${ghcr_digest}" = "${tcr_digest}"');
expect(workflow).toContain('for image in "${GHCR_IMAGE_NAME}" "${TCR_IMAGE_NAME}"');