77 version :
88 required : true
99 type : string
10+ platforms :
11+ required : false
12+ type : string
13+ default : " linux/amd64,linux/arm64"
1014 working-dir :
1115 required : true
1216 type : string
@@ -24,28 +28,32 @@ jobs:
2428 steps :
2529 - name : ⬇️ Checkout
2630 uses : actions/checkout@v2
27- - name : Download artifact
31+ - name : 📦 Download artifact
2832 uses : actions/download-artifact@v2
2933 if : inputs.artifact-name && inputs.artifact-path
3034 with :
3135 name : ${{ inputs.artifact-name }}
3236 path : ${{ inputs.artifact-path }}
37+ - name : 🦤 Set up qemu
38+ uses : docker/setup-qemu-action@v1
39+ - name : 🐳 Set up docker buildx
40+ uses : docker/setup-buildx-action@v1
3341 - name : 🧰 Build container image
42+ if : github.ref != 'refs/heads/main' || inputs.version == 'dev'
3443 working-directory : ${{ inputs.working-dir }}
35- run : |
36- docker build \
37- -t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:latest" \
38- -t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)" \
39- -t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:${{ inputs.version }}" .
44+ run : docker buildx build --platform "${{ inputs.platforms }}" .
4045 - name : 🔑 Login to GitHub Container registry
46+ if : github.ref == 'refs/heads/main' && inputs.version != 'dev'
4147 uses : docker/login-action@v1
4248 with :
4349 registry : ghcr.io
4450 username : ${{ github.actor }}
4551 password : ${{ secrets.GITHUB_TOKEN }}
46- - name : ⬆️ Push container image
52+ - name : 🧰 ⬆️ Build and push container image
4753 if : github.ref == 'refs/heads/main' && inputs.version != 'dev'
54+ working-directory : ${{ inputs.working-dir }}
4855 run : |
49- docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:latest"
50- docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)"
51- docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:${{ inputs.version }}"
56+ docker buildx build --push --platform "${{ inputs.platforms }}" \
57+ -t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:latest" \
58+ -t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)" \
59+ -t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:${{ inputs.version }}" .
0 commit comments