@@ -29,45 +29,38 @@ jobs:
2929 key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
3030 restore-keys : |
3131 ${{ runner.os }}-go-
32+ - uses : docker/setup-qemu-action@v1
33+ - uses : docker/setup-buildx-action@v1
3234 - uses : sigstore/cosign-installer@main
3335 - uses : anchore/sbom-action/download-syft@v0
34- - uses : docker/login-action@v1
36+ - name : Docker login
37+ uses : docker/login-action@v1
3538 with :
3639 registry : ghcr.io
3740 username : fluxcdbot
3841 password : ${{ secrets.GHCR_TOKEN }}
39- - name : Prepare
40- id : prep
41- run : |
42- VERSION="${{ github.event.inputs.tag }}-${GITHUB_SHA::8}"
43- if [[ $GITHUB_REF == refs/tags/* ]]; then
44- VERSION=${GITHUB_REF/refs\/tags\//}
45- fi
46- echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
47- echo ::set-output name=VERSION::${VERSION}
48- - name : Publish multi-arch container image
42+ - name : Docker meta
43+ id : meta
44+ uses : docker/metadata-action@v3
45+ with :
46+ images : ghcr.io/fluxcd/${{ env.CONTROLLER }}
47+ tags : |
48+ type=raw,value={{tag}}
49+ - name : Docker push
4950 uses : docker/build-push-action@v2
5051 with :
5152 push : true
5253 builder : ${{ steps.buildx.outputs.name }}
5354 context : .
5455 file : ./Dockerfile
5556 platforms : linux/amd64,linux/arm/v7,linux/arm64
56- tags : |
57- ghcr.io/fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
58- labels : |
59- org.opencontainers.image.title=${{ github.event.repository.name }}
60- org.opencontainers.image.description=${{ github.event.repository.description }}
61- org.opencontainers.image.url=${{ github.event.repository.html_url }}
62- org.opencontainers.image.source=${{ github.event.repository.html_url }}
63- org.opencontainers.image.revision=${{ github.sha }}
64- org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
65- org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
66- - name : Sign multi-arch container image
57+ tags : ${{ steps.meta.outputs.tags }}
58+ labels : ${{ steps.meta.outputs.labels }}
59+ - name : Docker sign
6760 env :
6861 COSIGN_EXPERIMENTAL : 1
6962 run : |
70- cosign sign ghcr.io/fluxcd/ ${{ env.CONTROLLER }}:${{ steps.prep .outputs.VERSION }}
63+ cosign sign ${{ steps.meta .outputs.tags }}
7164 - uses : goreleaser/goreleaser-action@v2
7265 with :
7366 version : latest
0 commit comments