@@ -149,3 +149,65 @@ jobs:
149149 echo "---"
150150 echo "### Release Draft: ${{ env.VERSION }}" >> $GITHUB_STEP_SUMMARY
151151 echo "${{ steps.create-release-draft.outputs.url }}" >> $GITHUB_STEP_SUMMARY
152+
153+ build-docker :
154+ name : Build and push Docker image
155+ needs : extract-version
156+ if : ${{ github.event.inputs.build-docker == 'true' || github.event_name == 'push' }}
157+ runs-on : ubuntu-latest
158+ permissions :
159+ contents : read
160+ packages : write
161+ env :
162+ VERSION : ${{ needs.extract-version.outputs.VERSION }}
163+
164+ steps :
165+ - name : Checkout
166+ uses : actions/checkout@v4
167+
168+ - name : Set up QEMU
169+ uses : docker/setup-qemu-action@v3
170+
171+ - name : Set up Docker Buildx
172+ uses : docker/setup-buildx-action@v3
173+
174+ - name : Login to GitHub Container Registry
175+ uses : docker/login-action@v3
176+ with :
177+ registry : ghcr.io
178+ username : ${{ github.actor }}
179+ password : ${{ secrets.GITHUB_TOKEN }}
180+
181+ - name : Extract metadata for Docker
182+ id : meta
183+ uses : docker/metadata-action@v5
184+ with :
185+ images : ghcr.io/${{ github.repository }}
186+ tags : |
187+ type=semver,pattern={{version}},value=${{ env.VERSION }}
188+ type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }}
189+ type=semver,pattern={{major}},value=${{ env.VERSION }}
190+ type=sha,prefix=sha-
191+ type=raw,value=latest,enable=${{ !contains(env.VERSION, '-') }}
192+
193+ - name : Build and push
194+ uses : docker/build-push-action@v6
195+ with :
196+ context : .
197+ platforms : linux/amd64,linux/arm64
198+ push : true
199+ tags : ${{ steps.meta.outputs.tags }}
200+ labels : ${{ steps.meta.outputs.labels }}
201+ cache-from : type=gha
202+ cache-to : type=gha,mode=max
203+
204+ - name : Write GitHub Step Summary
205+ run : |
206+ echo "### Docker Image Published" >> $GITHUB_STEP_SUMMARY
207+ echo "" >> $GITHUB_STEP_SUMMARY
208+ echo "**Image:** \`ghcr.io/${{ github.repository }}\`" >> $GITHUB_STEP_SUMMARY
209+ echo "" >> $GITHUB_STEP_SUMMARY
210+ echo "**Tags:**" >> $GITHUB_STEP_SUMMARY
211+ echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
212+ echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
213+ echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
0 commit comments