|
24 | 24 | on: |
25 | 25 | workflow_dispatch: |
26 | 26 | inputs: |
27 | | - push_to_NGC: |
28 | | - required: false |
29 | | - type: boolean |
30 | | - default: false |
31 | | - description: 'Push the built source image to NGC, otherwise push to GHCR.' |
32 | | - environment: |
33 | | - required: false |
34 | | - type: string |
35 | 27 | artifact_url: |
36 | 28 | required: false |
37 | 29 | type: string |
@@ -378,39 +370,43 @@ jobs: |
378 | 370 | push: false |
379 | 371 |
|
380 | 372 | - name: Log in to GitHub CR |
381 | | - if: github.event.inputs.push_to_NGC != 'true' |
382 | 373 | uses: docker/login-action@v3 |
383 | 374 | with: |
384 | 375 | registry: ghcr.io |
385 | 376 | username: ${{ github.actor }} |
386 | 377 | password: ${{ github.token }} |
387 | 378 |
|
388 | | - - name: Log in to NGC |
389 | | - if: github.event.inputs.push_to_NGC == 'true' |
390 | | - uses: docker/login-action@v3 |
391 | | - with: |
392 | | - registry: nvcr.io |
393 | | - username: '$oauthtoken' |
394 | | - password: ${{ secrets.NGC_CREDENTIALS }} |
395 | | - |
396 | | - - name: Tag and push to GHCR or NGC |
| 379 | + - name: Tag and push amd64 image |
397 | 380 | id: push |
398 | 381 | run: | |
399 | 382 | docker load --input /tmp/package-sources.tar |
400 | 383 | cuda_major=$(echo "${{ matrix.cuda }}" | cut -d. -f1) |
401 | 384 | target_image="nvcr.io/nvidia/nightly/cuda-quantum:cu${cuda_major}-latest" |
402 | 385 | tag_suffix="${target_image##*:}" |
403 | | - if [ "${{ github.event.inputs.push_to_NGC }}" = "true" ]; then |
404 | | - # Derive push destination from target_image: .../cuda-quantum:tag -> .../cuda-quantum-src:tag |
405 | | - repo_part="${target_image%:*}" |
406 | | - tag="${repo_part}-src:${tag_suffix}" |
407 | | - else |
408 | | - owner_lower=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') |
409 | | - tag="ghcr.io/${owner_lower}/cuda-quantum-src:${tag_suffix}" |
410 | | - fi |
411 | | - docker tag package-sources:latest "$tag" |
412 | | - docker push "$tag" |
| 386 | + owner_lower=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') |
| 387 | + tag="ghcr.io/${owner_lower}/cuda-quantum-src:${tag_suffix}" |
| 388 | + tag_amd64="${tag}-amd64" |
| 389 | + docker tag package-sources:latest "$tag_amd64" |
| 390 | + docker push "$tag_amd64" |
413 | 391 | echo "image_tag=$tag" | tee -a $GITHUB_OUTPUT |
| 392 | + echo "tag_amd64=$tag_amd64" | tee -a $GITHUB_OUTPUT |
| 393 | +
|
| 394 | + - name: Create arm64 manifest from amd64 (same contents) |
| 395 | + run: | |
| 396 | + tag="${{ steps.push.outputs.image_tag }}" |
| 397 | + tag_amd64="${{ steps.push.outputs.tag_amd64 }}" |
| 398 | + tag_arm64="${tag}-arm64" |
| 399 | + docker run --rm \ |
| 400 | + -v $HOME/.docker/config.json:/root/.docker/config.json:ro \ |
| 401 | + gcr.io/go-containerregistry/crane:latest \ |
| 402 | + copy --platform=linux/arm64 "$tag_amd64" "$tag_arm64" |
| 403 | +
|
| 404 | + - name: Create and push multi-arch manifest |
| 405 | + run: | |
| 406 | + tag="${{ steps.push.outputs.image_tag }}" |
| 407 | + tag_amd64="${{ steps.push.outputs.tag_amd64 }}" |
| 408 | + tag_arm64="${tag}-arm64" |
| 409 | + docker buildx imagetools create --tag "$tag" "$tag_amd64" "$tag_arm64" --push |
414 | 410 |
|
415 | 411 | - name: Summary |
416 | 412 | run: | |
|
0 commit comments