7
7
inputs :
8
8
tag :
9
9
description : ' image tag prefix'
10
- default : ' rc '
10
+ default : ' preview '
11
11
required : true
12
12
13
13
permissions :
14
- contents : write # needed to write releases
15
- id-token : write # needed for keyless signing
16
- packages : write # needed for ghcr access
14
+ contents : read
17
15
18
16
env :
19
17
CONTROLLER : ${{ github.event.repository.name }}
20
18
21
19
jobs :
22
- build-push :
20
+ release :
21
+ outputs :
22
+ hashes : ${{ steps.slsa.outputs.hashes }}
23
+ image_url : ${{ steps.slsa.outputs.image_url }}
24
+ image_digest : ${{ steps.slsa.outputs.image_digest }}
23
25
runs-on : ubuntu-latest
26
+ permissions :
27
+ contents : write # for creating the GitHub release.
28
+ id-token : write # for creating OIDC tokens for signing.
29
+ packages : write # for pushing and signing container images.
24
30
steps :
25
31
- name : Checkout
26
- uses : actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
32
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
27
33
- name : Setup Kustomize
28
34
uses : fluxcd/pkg/actions/kustomize@main
29
35
- name : Prepare
@@ -36,32 +42,33 @@ jobs:
36
42
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
37
43
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
38
44
- name : Setup QEMU
39
- uses : docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1 .0
45
+ uses : docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0 .0
40
46
- name : Setup Docker Buildx
41
47
id : buildx
42
- uses : docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5 .0
48
+ uses : docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0 .0
43
49
- name : Login to GitHub Container Registry
44
- uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1 .0
50
+ uses : docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0 .0
45
51
with :
46
52
registry : ghcr.io
47
53
username : fluxcdbot
48
54
password : ${{ secrets.GHCR_TOKEN }}
49
55
- name : Login to Docker Hub
50
- uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1 .0
56
+ uses : docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0 .0
51
57
with :
52
58
username : fluxcdbot
53
59
password : ${{ secrets.DOCKER_FLUXCD_PASSWORD }}
54
60
- name : Generate images meta
55
61
id : meta
56
- uses : docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # v4.3 .0
62
+ uses : docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0 .0
57
63
with :
58
64
images : |
59
65
fluxcd/${{ env.CONTROLLER }}
60
66
ghcr.io/fluxcd/${{ env.CONTROLLER }}
61
67
tags : |
62
68
type=raw,value=${{ steps.prep.outputs.VERSION }}
63
69
- name : Publish images
64
- uses : docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
70
+ id : build-push
71
+ uses : docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
65
72
with :
66
73
sbom : true
67
74
provenance : true
@@ -72,32 +79,82 @@ jobs:
72
79
platforms : linux/amd64,linux/arm/v7,linux/arm64
73
80
tags : ${{ steps.meta.outputs.tags }}
74
81
labels : ${{ steps.meta.outputs.labels }}
75
- - name : Check images
76
- run : |
77
- docker buildx imagetools inspect docker.io/fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
78
- docker buildx imagetools inspect ghcr.io/fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
79
- docker pull docker.io/fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
80
- docker pull ghcr.io/fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
81
- - uses : sigstore/cosign-installer@9e9de2292db7abb3f51b7f4808d98f0d347a8919 # v3.0.2
82
+ - uses : sigstore/cosign-installer@1fc5bd396d372bee37d608f955b336615edf79c8 # v3.2.0
82
83
- name : Sign images
83
84
env :
84
85
COSIGN_EXPERIMENTAL : 1
85
86
run : |
86
- cosign sign --yes fluxcd/${{ env.CONTROLLER }}: ${{ steps.prep .outputs.VERSION }}
87
- cosign sign --yes ghcr.io/fluxcd/${{ env.CONTROLLER }}: ${{ steps.prep .outputs.VERSION }}
87
+ cosign sign --yes fluxcd/${{ env.CONTROLLER }}@ ${{ steps.build-push .outputs.digest }}
88
+ cosign sign --yes ghcr.io/fluxcd/${{ env.CONTROLLER }}@ ${{ steps.build-push .outputs.digest }}
88
89
- name : Generate release artifacts
89
90
if : startsWith(github.ref, 'refs/tags/v')
90
91
run : |
91
92
mkdir -p config/release
92
93
kustomize build ./config/crd > ./config/release/${{ env.CONTROLLER }}.crds.yaml
93
94
kustomize build ./config/manager > ./config/release/${{ env.CONTROLLER }}.deployment.yaml
94
- echo '[CHANGELOG](https://github.com/fluxcd/${{ env.CONTROLLER }}/blob/main/CHANGELOG.md)' > ./config/release/notes.md
95
- - uses : anchore/sbom-action/download-syft@422cb34a0f8b599678c41b21163ea6088edb2624 # v0.14.1
95
+ - uses : anchore/sbom-action/download-syft@78fc58e266e87a38d4194b2137a3d4e9bcaf7ca1 # v0.14.3
96
96
- name : Create release and SBOM
97
+ id : run-goreleaser
97
98
if : startsWith(github.ref, 'refs/tags/v')
98
- uses : goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2 .0
99
+ uses : goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0 .0
99
100
with :
100
101
version : latest
101
- args : release --release-notes=config/release/notes.md --rm-dist --skip-validate
102
+ args : release --clean --skip-validate
102
103
env :
103
104
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
105
+ - name : Generate SLSA metadata
106
+ id : slsa
107
+ env :
108
+ ARTIFACTS : " ${{ steps.run-goreleaser.outputs.artifacts }}"
109
+ run : |
110
+ hashes=$(echo -E $ARTIFACTS | jq --raw-output '.[] | {name, "digest": (.extra.Digest // .extra.Checksum)} | select(.digest) | {digest} + {name} | join(" ") | sub("^sha256:";"")' | base64 -w0)
111
+ echo "hashes=$hashes" >> $GITHUB_OUTPUT
112
+
113
+ image_url=fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.version }}
114
+ echo "image_url=$image_url" >> $GITHUB_OUTPUT
115
+
116
+ image_digest=${{ steps.build-push.outputs.digest }}
117
+ echo "image_digest=$image_digest" >> $GITHUB_OUTPUT
118
+
119
+ release-provenance :
120
+ needs : [release]
121
+ permissions :
122
+ actions : read # for detecting the Github Actions environment.
123
+ id-token : write # for creating OIDC tokens for signing.
124
+ contents : write # for uploading attestations to GitHub releases.
125
+ if : startsWith(github.ref, 'refs/tags/v')
126
+ uses :
slsa-framework/slsa-github-generator/.github/workflows/[email protected]
127
+ with :
128
+ provenance-name : " provenance.intoto.jsonl"
129
+ base64-subjects : " ${{ needs.release.outputs.hashes }}"
130
+ upload-assets : true
131
+
132
+ dockerhub-provenance :
133
+ needs : [release]
134
+ permissions :
135
+ actions : read # for detecting the Github Actions environment.
136
+ id-token : write # for creating OIDC tokens for signing.
137
+ packages : write # for uploading attestations.
138
+ if : startsWith(github.ref, 'refs/tags/v')
139
+ uses :
slsa-framework/slsa-github-generator/.github/workflows/[email protected]
140
+ with :
141
+ image : ${{ needs.release.outputs.image_url }}
142
+ digest : ${{ needs.release.outputs.image_digest }}
143
+ registry-username : fluxcdbot
144
+ secrets :
145
+ registry-password : ${{ secrets.DOCKER_FLUXCD_PASSWORD }}
146
+
147
+ ghcr-provenance :
148
+ needs : [release]
149
+ permissions :
150
+ actions : read # for detecting the Github Actions environment.
151
+ id-token : write # for creating OIDC tokens for signing.
152
+ packages : write # for uploading attestations.
153
+ if : startsWith(github.ref, 'refs/tags/v')
154
+ uses :
slsa-framework/slsa-github-generator/.github/workflows/[email protected]
155
+ with :
156
+ image : ghcr.io/${{ needs.release.outputs.image_url }}
157
+ digest : ${{ needs.release.outputs.image_digest }}
158
+ registry-username : fluxcdbot
159
+ secrets :
160
+ registry-password : ${{ secrets.GHCR_TOKEN }}
0 commit comments