2727 default : ' .'
2828
2929jobs :
30- docker :
31- name : Docker Build and Push Image ${{ matrix.architecture }}
32- runs-on : ubuntu-latest
33- strategy :
34- matrix :
35- architecture : [arm64, amd64]
30+ dockerARM64 :
31+ name : Docker Build and Push Image ARM64
32+ runs-on : ARM64
3633 defaults :
3734 run :
3835 working-directory : ${{ inputs.working-directory }}
@@ -44,48 +41,54 @@ jobs:
4441 uses : WyriHaximus/github-action-get-previous-tag@v1
4542 with :
4643 fallback : latest
47- - name : Set up QEMU
48- uses : docker/setup-qemu -action@v1
44+ - name : Log in to the container registry
45+ uses : docker/login -action@v1
4946 with :
50- platforms : linux/${{ matrix.architecture }}
51- - name : Set up docker buildx
52- uses : docker/setup-buildx-action@v1
47+ registry : ghcr.io
48+ username : ${{ github.actor }}
49+ password : ${{ secrets.GITHUB_TOKEN }}
50+ - name : Build and push docker image
51+ id : buildandpush
52+ uses : docker/build-push-action@v2
5353 with :
54- install : true
55- - name : Docker meta
56- id : meta
57- uses : docker/metadata-action@v3
54+ context : .
55+ file : ${{ inputs.docker-file }}
56+ build-args : |
57+ baseimage=swiftarm/swift:5.5.1-ubuntu-focal
58+ push : true
59+ tags : ghcr.io/${{ inputs.image-name }}:latest-arm64,ghcr.io/${{ inputs.image-name }}:${{ steps.latesttag.outputs.tag }}-arm64
60+ dockerAMD64 :
61+ name : Docker Build and Push Image AMD64
62+ runs-on : ubuntu-latest
63+ defaults :
64+ run :
65+ working-directory : ${{ inputs.working-directory }}
66+ steps :
67+ - name : Checkout repository
68+ uses : actions/checkout@v2
69+ - name : Get latest tag
70+ id : latesttag
71+ uses : WyriHaximus/github-action-get-previous-tag@v1
5872 with :
59- images : ${{ inputs.image-name }}
73+ fallback : latest
6074 - name : Log in to the container registry
6175 uses : docker/login-action@v1
6276 with :
6377 registry : ghcr.io
6478 username : ${{ github.actor }}
6579 password : ${{ secrets.GITHUB_TOKEN }}
66- - name : Determine Base Image
67- uses : haya14busa/action-cond@v1
68- id : baseimage
69- with :
70- cond : ${{ matrix.architecture == 'arm64' }}
71- if_true : ' swiftarm/swift:5.5.1-ubuntu-focal'
72- if_false : ' swift:focal'
7380 - name : Build and push docker image
7481 id : buildandpush
7582 uses : docker/build-push-action@v2
7683 with :
7784 context : .
7885 file : ${{ inputs.docker-file }}
7986 build-args : |
80- baseimage=${{ steps.baseimage.outputs.value }}
87+ baseimage=swift:focal
8188 push : true
82- platforms : linux/${{ matrix.architecture }}
83- tags : ghcr.io/${{ inputs.image-name }}:latest-${{ matrix.architecture }},ghcr.io/${{ inputs.image-name }}:${{ steps.latesttag.outputs.tag }}-${{ matrix.architecture }}
84- labels : ${{ steps.meta.outputs.labels }}
85- - name : Image digest
86- run : echo ${{ steps.buildandpush.outputs.digest }}
89+ tags : ghcr.io/${{ inputs.image-name }}:latest-amd64,ghcr.io/${{ inputs.image-name }}:${{ steps.latesttag.outputs.tag }}-amd64
8790 dockermanifest :
88- needs : [docker ]
91+ needs : [dockerARM64, dockerAMD64 ]
8992 name : Create Multi-CPU Architecture Image
9093 runs-on : ubuntu-latest
9194 steps :
0 commit comments