3131
3232jobs :
3333 build :
34- runs-on : ubuntu-latest-m
34+ runs-on : ${{ matrix.runner }}
3535 # Skip if triggered by failed nvim-dev workflow
3636 if : ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
37+ strategy :
38+ fail-fast : false
39+ matrix :
40+ include :
41+ - platform : linux/amd64
42+ runner : ubuntu-latest-m
43+ suffix : amd64
44+ - platform : linux/arm64
45+ runner : ubuntu-latest-m-arm
46+ suffix : arm64
3747 permissions :
3848 contents : read
3949 packages : write
4252 - name : Checkout repository
4353 uses : actions/checkout@v6
4454
45- - name : Set up QEMU
46- uses : docker/setup-qemu-action@v3
47-
4855 - name : Set up Docker Buildx
4956 uses : docker/setup-buildx-action@v3
5057
@@ -62,24 +69,51 @@ jobs:
6269 with :
6370 images : ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}
6471 tags : |
65- type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
66- type=sha,prefix=
67- type=ref,event=pr
72+ type=raw,value=latest-${{ matrix.suffix }} ,enable=${{ github.ref == 'refs/heads/main' }}
73+ type=sha,prefix=,suffix=-${{ matrix.suffix }}
74+ type=ref,event=pr,suffix=-${{ matrix.suffix }}
6875
6976 - name : Build and push
7077 uses : docker/build-push-action@v6
7178 with :
7279 context : dot_files/ai-dev
7380 file : dot_files/ai-dev/Containerfile
74- platforms : linux/amd64,linux/arm64
81+ platforms : ${{ matrix.platform }}
7582 push : ${{ github.event_name != 'pull_request' }}
7683 tags : ${{ steps.meta.outputs.tags }}
7784 labels : ${{ steps.meta.outputs.labels }}
78- cache-from : type=gha
79- cache-to : type=gha,mode=max
85+ cache-from : type=gha,scope=${{ matrix.suffix }}
86+ cache-to : type=gha,mode=max,scope=${{ matrix.suffix }}
87+
88+ manifest :
89+ needs : build
90+ runs-on : ubuntu-latest
91+ if : github.event_name != 'pull_request'
92+ permissions :
93+ packages : write
94+
95+ steps :
96+ - name : Log in to GitHub Container Registry
97+ uses : docker/login-action@v3
98+ with :
99+ registry : ghcr.io
100+ username : ${{ github.actor }}
101+ password : ${{ secrets.GITHUB_TOKEN }}
102+
103+ - name : Create and push manifest
104+ run : |
105+ docker manifest create ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
106+ ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:latest-amd64 \
107+ ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:latest-arm64
108+ docker manifest push ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
109+
110+ # Also create SHA manifest
111+ docker manifest create ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \
112+ ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-amd64 \
113+ ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-arm64
114+ docker manifest push ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
80115
81116 - name : Generate build summary
82- if : github.event_name != 'pull_request'
83117 run : |
84118 echo "## ai-dev Image Built" >> $GITHUB_STEP_SUMMARY
85119 echo "" >> $GITHUB_STEP_SUMMARY
0 commit comments