Skip to content

Self-hosted workflows for coding-agent delivery. Orchestrate CodeBuddy, Codex and Claude Code with scripts and human approval gates. Includes Local workflows for coding assistants.

ci: mirror the platform image to TCR after publishing GHCR (#205)

cocofhu35cc1ebd2624
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 65715602..397edd93 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -23,7 +23,14 @@ concurrency:
jobs:
release:
runs-on: ubuntu-latest
- timeout-minutes: 60
+ timeout-minutes: 45
+ outputs:
+ digest: ${{ steps.push.outputs.digest }}
+ tag: ${{ steps.release.outputs.tag }}
+ version: ${{ steps.release.outputs.version }}
+ sha: ${{ steps.release.outputs.sha }}
+ image: ${{ steps.release.outputs.image }}
+ prerelease: ${{ steps.release.outputs.prerelease }}
steps:
- uses: actions/[email protected]
with:
@@ -67,6 +74,7 @@ jobs:
{
echo "tag=${TAG}"
echo "version=${version}"
+ echo "sha=$(git rev-parse HEAD)"
echo "image=${image}"
echo "prerelease=${prerelease}"
} >> "$GITHUB_OUTPUT"
@@ -108,23 +116,15 @@ jobs:
echo "image=${registry}/loopforge/loopforge"
} >> "$GITHUB_OUTPUT"
- - uses: docker/login-action@v4
- with:
- registry: ${{ steps.tcr.outputs.registry }}
- username: ${{ secrets.TCR_USERNAME }}
- password: ${{ secrets.TCR_PASSWORD }}
-
- uses: docker/metadata-action@v5
id: metadata
with:
- images: |
- ${{ steps.release.outputs.image }}
- ${{ steps.tcr.outputs.image }}
+ images: ${{ steps.release.outputs.image }}
flavor: latest=false
tags: |
type=semver,pattern={{version}},value=${{ steps.release.outputs.tag }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.release.outputs.tag }}
- type=sha,prefix=sha-,format=long
+ type=raw,value=sha-${{ steps.release.outputs.sha }}
type=raw,value=latest,enable=${{ steps.release.outputs.prerelease == 'false' }}
- uses: docker/build-push-action@v7
@@ -148,15 +148,71 @@ jobs:
- if: failure()
run: docker compose logs platform | tail -200
+ mirror:
+ needs: release
+ runs-on: ubuntu-latest
+ timeout-minutes: 30
+ steps:
+ - uses: actions/[email protected]
+ with:
+ fetch-depth: 0
+ ref: ${{ needs.release.outputs.tag }}
+
+ - uses: docker/login-action@v4
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - uses: docker/login-action@v4
+ with:
+ registry: ${{ secrets.TCR_REGISTRY }}
+ username: ${{ secrets.TCR_USERNAME }}
+ password: ${{ secrets.TCR_PASSWORD }}
+
+ # Keep the registry host in this job. Job outputs that contain a secret
+ # are dropped before the next job starts.
+ - name: Mirror the published image to TCR
+ env:
+ TCR_REGISTRY: ${{ secrets.TCR_REGISTRY }}
+ SRC_IMAGE: ${{ needs.release.outputs.image }}
+ DIGEST: ${{ needs.release.outputs.digest }}
+ VERSION: ${{ needs.release.outputs.version }}
+ SHA: ${{ needs.release.outputs.sha }}
+ PRERELEASE: ${{ needs.release.outputs.prerelease }}
+ run: |
+ sudo apt-get update -qq
+ sudo apt-get install -y skopeo
+ registry="$(printf '%s' "${TCR_REGISTRY}" | tr -d '[:space:]')"
+ if [[ ! "${registry}" =~ ^[a-z0-9]([a-z0-9.-]*[a-z0-9])?(:[0-9]+)?$ ]]; then
+ echo "TCR_REGISTRY must be the registry host, for example ccr.ccs.tencentyun.com" >&2
+ exit 1
+ fi
+ tcr_image="${registry}/loopforge/loopforge"
+ echo "TCR_IMAGE=${tcr_image}" >> "$GITHUB_ENV"
+ src="docker://${SRC_IMAGE}@${DIGEST}"
+ auth="${HOME}/.docker/config.json"
+ copy() {
+ echo "mirroring ${src} -> ${tcr_image}:$1"
+ skopeo copy --all --retry-times 3 \
+ --src-authfile "${auth}" --dest-authfile "${auth}" \
+ "${src}" "docker://${tcr_image}:$1"
+ }
+ copy "${VERSION}"
+ copy "sha-${SHA}"
+ if [[ "${PRERELEASE}" != "true" ]]; then
+ copy "${VERSION%.*}"
+ copy latest
+ fi
+
- name: Create or update GitHub Release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
- TAG: ${{ steps.release.outputs.tag }}
- VERSION: ${{ steps.release.outputs.version }}
- IMAGE: ${{ steps.release.outputs.image }}
- TCR_IMAGE: ${{ steps.tcr.outputs.image }}
- PRERELEASE: ${{ steps.release.outputs.prerelease }}
+ TAG: ${{ needs.release.outputs.tag }}
+ VERSION: ${{ needs.release.outputs.version }}
+ IMAGE: ${{ needs.release.outputs.image }}
+ PRERELEASE: ${{ needs.release.outputs.prerelease }}
run: |
notes="$(cat <<EOF
## Install