2929 if : github.event.pull_request.draft == false
3030 runs-on : ubuntu-24.04
3131 steps :
32+ - name : Harden Runner
33+ uses : step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
34+ with :
35+ egress-policy : audit
36+
3237 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
3338 - uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
3439 id : changes
6166 PUSH : ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
6267
6368 steps :
69+ - name : Harden Runner
70+ uses : step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
71+ with :
72+ egress-policy : audit
73+
6474 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
6575
6676 # Lint the Dockerfile first before setting anything up
6979 with :
7080 dockerfile : " Dockerfile"
7181
82+ - name : Set up Go
83+ uses : actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
84+ with :
85+ go-version-file : " go.mod"
86+
7287 - name : Set up QEMU
73- uses : docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3
88+ uses : docker/setup-qemu-action@53851d14592bedcffcf25ea515637cff71ef929a # v3
7489 with :
7590 image : tonistiigi/binfmt:latest
7691 platforms : arm64,arm
8297 driver-opts : |
8398 image=moby/buildkit:v0.14.0
8499
100+ - name : " Install cosign"
101+ uses : sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
102+ if : env.PUSH == 'true' && github.event_name != 'pull_request'
103+
85104 # release version is the name of the tag i.e. v0.10.0
86105 # release version also has the image type appended i.e. v0.10.0-alpine
87106 # release tag is either pre-release or latest i.e. latest
@@ -136,7 +155,7 @@ jobs:
136155 - name : " Build ${{ env.PUSH == 'true' && 'and push' || '' }} ${{ env.DOCKER_REPO }} image"
137156 id : build
138157 if : contains(fromJson('["push", "pull_request"]'), github.event_name)
139- uses : docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6
158+ uses : docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6
140159 with :
141160 cache-from : type=gha
142161 cache-to : type=gha,mode=max
@@ -146,21 +165,36 @@ jobs:
146165 ATLANTIS_VERSION=${{ env.RELEASE_VERSION }}
147166 ATLANTIS_COMMIT=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
148167 ATLANTIS_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
149- platforms : linux/arm64/v8,linux/amd64,linux/arm/v7
168+ platforms : linux/arm64/v8, linux/amd64, linux/arm/v7
150169 push : ${{ env.PUSH }}
151170 tags : ${{ steps.meta.outputs.tags }}
152171 target : ${{ matrix.image_type }}
153172 labels : ${{ steps.meta.outputs.labels }}
154173 outputs : type=image,name=target,annotation-index.org.opencontainers.image.description=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }}
155174
156- - name : " Sign and Attest Image"
157- if : env.PUSH == 'true'
175+ - name : " Create Image Attestation "
176+ if : env.PUSH == 'true' && github.event_name != 'pull_request'
158177 uses : actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
159178 with :
160179 subject-digest : ${{ steps.build.outputs.digest }}
161180 subject-name : ghcr.io/${{ github.repository }}
162181 push-to-registry : true
163182
183+ - name : " Sign images with environment annotations"
184+ # no key needed, we're using the GitHub OIDC flow
185+ if : env.PUSH == 'true' && github.event_name != 'pull_request'
186+ run : |
187+ # Sign dev tags, version tags, and latest tags
188+ echo "${TAGS}" | xargs -I {} cosign sign \
189+ --yes \
190+ -a actor=${{ github.actor}} \
191+ -a ref_name=${{ github.ref_name}} \
192+ -a ref=${{ github.sha }} \
193+ {}@${DIGEST}
194+ env :
195+ TAGS : ${{ steps.meta.outputs.tags }}
196+ DIGEST : ${{ steps.build.outputs.digest }}
197+
164198 test :
165199 needs : [changes]
166200 if : needs.changes.outputs.should-run-build == 'true'
@@ -169,13 +203,18 @@ jobs:
169203 strategy :
170204 matrix :
171205 image_type : [alpine, debian]
206+ platform : [linux/arm64/v8, linux/amd64, linux/arm/v7]
172207 env :
173208 # Set docker repo to either the fork or the main repo where the branch exists
174209 DOCKER_REPO : ghcr.io/${{ github.repository }}
175210
176211 steps :
177- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
212+ - name : Harden Runner
213+ uses : step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
214+ with :
215+ egress-policy : audit
178216
217+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
179218 - name : Set up Docker Buildx
180219 uses : docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3
181220 # https://github.com/docker/build-push-action/issues/761#issuecomment-1575006515
@@ -185,7 +224,7 @@ jobs:
185224
186225 - name : " Build and load into Docker"
187226 if : contains(fromJson('["push", "pull_request"]'), github.event_name)
188- uses : docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6
227+ uses : docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6
189228 with :
190229 cache-from : type=gha
191230 cache-to : type=gha,mode=max
@@ -215,4 +254,10 @@ jobs:
215254 image_type : [alpine, debian]
216255 runs-on : ubuntu-24.04
217256 steps :
218- - run : ' echo "No build required"'
257+ - name : Harden Runner
258+ uses : step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
259+ with :
260+ egress-policy : audit
261+
262+ - run : ' echo "No build required"'
263+
0 commit comments