@@ -251,6 +251,22 @@ jobs:
251251 id : base-image
252252 run : echo "base_image=nvcr.io/nvidia/cuda:${{ matrix.cuda }}.0-runtime-ubuntu24.04" >> $GITHUB_OUTPUT
253253
254+ - name : Set destination image
255+ id : destination-image
256+ run : |
257+ # hard-coded to nightly because previous job is matrixed
258+ target_image="nvcr.io/nvidia/nightly/cuda-quantum:cu${cuda_major}-latest"
259+ tag_suffix="${target_image##*:}"
260+ if [ "${{ github.event.inputs.push_to_NGC }}" = "true" ]; then
261+ # Derive push destination from target_image: .../cuda-quantum:tag -> .../cuda-quantum-src:tag
262+ repo_part="${target_image%:*}"
263+ tag="${repo_part}-src:${tag_suffix}"
264+ else
265+ owner_lower=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
266+ tag="ghcr.io/${owner_lower}/cuda-quantum-src:${tag_suffix}"
267+ fi
268+ echo "destination_image=$tag" | tee -a $GITHUB_OUTPUT
269+
254270 - name : Download package lists (cudaq)
255271 uses : actions/download-artifact@v4
256272 with :
@@ -364,18 +380,9 @@ jobs:
364380 - name : Tag and push to GHCR or NGC
365381 id : push
366382 run : |
367- docker load --input /tmp/package-sources.tar
368383 cuda_major=$(echo "${{ matrix.cuda }}" | cut -d. -f1)
369- target_image="nvcr.io/nvidia/nightly/cuda-quantum:cu${cuda_major}-latest"
370- tag_suffix="${target_image##*:}"
371- if [ "${{ github.event.inputs.push_to_NGC }}" = "true" ]; then
372- # Derive push destination from target_image: .../cuda-quantum:tag -> .../cuda-quantum-src:tag
373- repo_part="${target_image%:*}"
374- tag="${repo_part}-src:${tag_suffix}"
375- else
376- owner_lower=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
377- tag="ghcr.io/${owner_lower}/cuda-quantum-src:${tag_suffix}"
378- fi
384+ docker load --input /tmp/package-sources.tar
385+ tag="${{ steps.destination-image.outputs.destination_image }}"
379386 docker tag package-sources:latest "$tag"
380387 docker push "$tag"
381388 echo "image_tag=$tag" | tee -a $GITHUB_OUTPUT
0 commit comments