@@ -340,6 +340,7 @@ jobs:
340340 env :
341341 # Pass the upstream token via env rather than `-t` so it doesn't appear in /proc/<pid>/cmdline.
342342 CPLN_TOKEN_STAGING : ${{ secrets.CPLN_TOKEN_STAGING }}
343+ CPLN_TOKEN_PRODUCTION : ${{ secrets.CPLN_TOKEN_PRODUCTION }}
343344 PRODUCTION_APP_NAME : ${{ vars.PRODUCTION_APP_NAME }}
344345 CPLN_ORG_STAGING : ${{ vars.CPLN_ORG_STAGING }}
345346 CPLN_ORG_PRODUCTION : ${{ vars.CPLN_ORG_PRODUCTION }}
@@ -379,7 +380,10 @@ jobs:
379380 '[.items[].name | select(startswith($prefix)) | (try capture("^[^:]+:(?<number>[0-9]+)") catch empty) | .number | tonumber] | max // 0'
380381 )"
381382 production_image="${PRODUCTION_APP_NAME}:$((latest_number + 1))_${staging_commit}"
383+ staging_registry="${CPLN_ORG_STAGING}.registry.cpln.io"
384+ production_registry="${CPLN_ORG_PRODUCTION}.registry.cpln.io"
382385 source_image_ref="${CPLN_ORG_STAGING}.registry.cpln.io/${STAGING_IMAGE}"
386+ production_image_ref="${CPLN_ORG_PRODUCTION}.registry.cpln.io/${production_image}"
383387
384388 docker_config_dir="$(mktemp -d)"
385389 cleanup_copy_credentials() {
@@ -391,14 +395,14 @@ jobs:
391395
392396 copy_status=1
393397 for attempt in $(seq 1 "${copy_image_attempts}"); do
394- if CPLN_TOKEN="${CPLN_TOKEN_STAGING}" cpln image docker-login --org "${CPLN_ORG_STAGING}" >/dev/null &&
398+ if printf '%s' "${CPLN_TOKEN_STAGING}" |
399+ docker login "${staging_registry}" -u '<token>' --password-stdin >/dev/null &&
400+ printf '%s' "${CPLN_TOKEN_PRODUCTION}" |
401+ docker login "${production_registry}" -u '<token>' --password-stdin >/dev/null &&
395402 docker manifest inspect "${source_image_ref}" >/dev/null &&
396- CPLN_TOKEN="${CPLN_TOKEN_STAGING}" \
397- cpln image copy "${STAGING_IMAGE}" \
398- --org "${CPLN_ORG_STAGING}" \
399- --to-profile default \
400- --to-org "${CPLN_ORG_PRODUCTION}" \
401- --to-name "${production_image}"; then
403+ docker pull "${source_image_ref}" &&
404+ docker tag "${source_image_ref}" "${production_image_ref}" &&
405+ docker push "${production_image_ref}"; then
402406 copy_status=0
403407 break
404408 else
0 commit comments