10
10
default : ' rc'
11
11
required : true
12
12
13
+ permissions :
14
+ contents : write # needed to write releases
15
+ id-token : write # needed for keyless signing
16
+ packages : write # needed for ghcr access
17
+
13
18
env :
14
19
CONTROLLER : ${{ github.event.repository.name }}
15
20
31
36
echo ::set-output name=VERSION::${VERSION}
32
37
- name : Setup QEMU
33
38
uses : docker/setup-qemu-action@v1
34
- with :
35
- platforms : all
36
39
- name : Setup Docker Buildx
37
40
id : buildx
38
41
uses : docker/setup-buildx-action@v1
39
- with :
40
- buildkitd-flags : " --debug"
41
42
- name : Login to GitHub Container Registry
42
43
uses : docker/login-action@v1
43
44
with :
@@ -49,43 +50,51 @@ jobs:
49
50
with :
50
51
username : fluxcdbot
51
52
password : ${{ secrets.DOCKER_FLUXCD_PASSWORD }}
52
- - name : Publish multi-arch container image
53
+ - name : Generate images meta
54
+ id : meta
55
+ uses : docker/metadata-action@v3
56
+ with :
57
+ images : |
58
+ fluxcd/${{ env.CONTROLLER }}
59
+ ghcr.io/fluxcd/${{ env.CONTROLLER }}
60
+ tags : |
61
+ type=raw,value=${{ steps.prep.outputs.VERSION }}
62
+ - name : Publish images
53
63
uses : docker/build-push-action@v2
54
64
with :
55
65
push : true
56
66
builder : ${{ steps.buildx.outputs.name }}
57
67
context : .
58
68
file : ./Dockerfile
59
69
platforms : linux/amd64,linux/arm/v7,linux/arm64
60
- tags : |
61
- ghcr.io/fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
62
- docker.io/fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
63
- labels : |
64
- org.opencontainers.image.title=${{ github.event.repository.name }}
65
- org.opencontainers.image.description=${{ github.event.repository.description }}
66
- org.opencontainers.image.url=${{ github.event.repository.html_url }}
67
- org.opencontainers.image.revision=${{ github.sha }}
68
- org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
69
- org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
70
+ tags : ${{ steps.meta.outputs.tags }}
71
+ labels : ${{ steps.meta.outputs.labels }}
70
72
- name : Check images
71
73
run : |
72
74
docker buildx imagetools inspect docker.io/fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
73
75
docker buildx imagetools inspect ghcr.io/fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
74
76
docker pull docker.io/fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
75
77
docker pull ghcr.io/fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
76
- - name : Generate release manifests
78
+ - uses : sigstore/cosign-installer@main
79
+ - name : Sign images
80
+ env :
81
+ COSIGN_EXPERIMENTAL : 1
82
+ run : |
83
+ cosign sign fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
84
+ cosign sign ghcr.io/fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
85
+ - name : Generate release artifacts
77
86
if : startsWith(github.ref, 'refs/tags/v')
78
87
run : |
79
88
mkdir -p config/release
80
89
kustomize build ./config/crd > ./config/release/${{ env.CONTROLLER }}.crds.yaml
81
90
kustomize build ./config/manager > ./config/release/${{ env.CONTROLLER }}.deployment.yaml
82
- - name : Create release
91
+ echo '[CHANGELOG](https://github.com/fluxcd/${{ env.CONTROLLER }}/blob/main/CHANGELOG.md)' > ./config/release/notes.md
92
+ - uses : anchore/sbom-action/download-syft@v0
93
+ - name : Create release and SBOM
83
94
if : startsWith(github.ref, 'refs/tags/v')
84
- uses : ncipollo/release -action@v1
95
+ uses : goreleaser/goreleaser -action@v2
85
96
with :
86
- prerelease : true
87
- artifacts : " config/release/*.yaml"
88
- artifactContentType : " text/plain"
89
- body : |
90
- [CHANGELOG](https://github.com/fluxcd/${{ env.CONTROLLER }}/blob/main/CHANGELOG.md)
91
- token : ${{ secrets.GITHUB_TOKEN }}
97
+ version : latest
98
+ args : release --release-notes=config/release/notes.md --rm-dist --skip-validate
99
+ env :
100
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments