@@ -380,3 +380,80 @@ jobs:
380
380
repository : fermyon/homebrew-tap
381
381
event-type : spin-release
382
382
client-payload : ' {"version": "${{ github.ref_name }}"}'
383
+
384
+ docker :
385
+ runs-on : " ubuntu-20.04"
386
+ needs : [build-and-sign, build-spin-static]
387
+ permissions :
388
+ contents : read
389
+ packages : write
390
+ env :
391
+ REGISTRY : ghcr.io
392
+ IMAGE_NAME : ${{ github.repository }}
393
+ strategy :
394
+ matrix :
395
+ config :
396
+ - { dockerfile: "Dockerfile", tag-suffix: "" }
397
+ - { dockerfile: "distroless.Dockerfile", tag-suffix: "-distroless" }
398
+ steps :
399
+ - name : Checkout
400
+ uses : actions/checkout@v4
401
+
402
+ - name : Setup version info
403
+ id : version
404
+ run : |
405
+ if [[ "${{ startsWith(github.ref, 'refs/tags/v') }}" == "true" ]]; then
406
+ echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
407
+ else
408
+ echo "version=canary" >> $GITHUB_OUTPUT
409
+ fi
410
+
411
+ - name : download release assets
412
+ uses : actions/download-artifact@v3
413
+ with :
414
+ name : spin
415
+
416
+ - name : extract binaries
417
+ shell : bash
418
+ run : |
419
+ if [[ "${{ matrix.config.tag-suffix }}" == "-distroless" ]]; then
420
+ static="-static"
421
+ fi
422
+ tar xvf spin-${{ steps.version.outputs.version }}${static}-linux-amd64.tar.gz
423
+ mv spin spin${static}-linux-amd64
424
+ tar xvf spin-${{ steps.version.outputs.version }}${static}-linux-aarch64.tar.gz
425
+ # Note: here we s/aarch64/arm64 to conform to Docker's TARGETARCH standards
426
+ mv spin spin${static}-linux-arm64
427
+
428
+ - name : Set up QEMU
429
+ uses : docker/setup-qemu-action@v3
430
+
431
+ - name : Set up Docker Buildx
432
+ uses : docker/setup-buildx-action@v3
433
+
434
+ - name : Log into registry ${{ env.REGISTRY }}
435
+ uses : docker/login-action@v3
436
+ with :
437
+ registry : ${{ env.REGISTRY }}
438
+ username : ${{ github.actor }}
439
+ password : ${{ secrets.GITHUB_TOKEN }}
440
+
441
+ - name : Extract Docker metadata
442
+ id : meta
443
+ uses : docker/metadata-action@v5
444
+ with :
445
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
446
+
447
+ - name : Build and Push
448
+ uses : docker/build-push-action@v6
449
+ with :
450
+ context : .
451
+ file : .github/${{ matrix.config.dockerfile }}
452
+ push : true
453
+ labels : ${{ steps.meta.outputs.labels }}
454
+ annotations : ${{ steps.meta.outputs.annotations }}
455
+ platforms : linux/amd64,linux/arm64
456
+ cache-from : type=gha
457
+ cache-to : type=gha,mode=max
458
+ tags : |
459
+ ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}${{ matrix.config.tag-suffix }}
0 commit comments