@@ -11,6 +11,9 @@ permissions:
1111jobs :
1212 goreleaser :
1313 runs-on : ubuntu-latest
14+ env :
15+ REGISTRY : ghcr.io
16+ IMAGE_NAME : ${{ github.repository }}
1417 steps :
1518 - name : Checkout
1619 uses : actions/checkout@v6
@@ -22,20 +25,41 @@ jobs:
2225 with :
2326 go-version-file : go.mod
2427
25- - name : Setup Docker Buildx
28+ - name : Run GoReleaser
29+ uses : goreleaser/goreleaser-action@v7
30+ with :
31+ version : ' ~> v2'
32+ args : release --clean
33+ env :
34+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
35+
36+ - name : Set up QEMU
37+ uses : docker/setup-qemu-action@v4
38+
39+ - name : Set up Docker Buildx
2640 uses : docker/setup-buildx-action@v4
2741
28- - name : Login to GHCR
42+ - name : Log in to GitHub Container Registry
2943 uses : docker/login-action@v4
3044 with :
31- registry : ghcr.io
45+ registry : ${{ env.REGISTRY }}
3246 username : ${{ github.actor }}
3347 password : ${{ secrets.GITHUB_TOKEN }}
3448
35- - name : Run GoReleaser
36- uses : goreleaser/goreleaser-action@v7
49+ - name : Extract Docker metadata
50+ id : meta
51+ uses : docker/metadata-action@v6
3752 with :
38- version : ' ~> v2'
39- args : release --clean
40- env :
41- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
53+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
54+ tags : |
55+ type=ref,event=tag
56+ type=raw,value=latest
57+
58+ - name : Build and push Docker image
59+ uses : docker/build-push-action@v7
60+ with :
61+ context : .
62+ platforms : linux/amd64,linux/arm64
63+ push : true
64+ tags : ${{ steps.meta.outputs.tags }}
65+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments