@@ -51,27 +51,29 @@ jobs:
5151
5252 steps :
5353 - name : Checkout repository
54- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
54+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
55+ with :
56+ fetch-tags : true
5557
5658 - name : Set up QEMU
57- uses : docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6 .0
59+ uses : docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7 .0
5860
5961 - name : Set up Docker Buildx
60- uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
62+ uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
6163
6264 - name : Set up Syft
63- uses : anchore/sbom-action/download-syft@f8bdd1d8ac5e901a77a92f111440fdb1b593736b # v0.20.6
65+ uses : anchore/sbom-action/download-syft@28d71544de8eaf1b958d335707167c5f783590ad # v0.22.2
6466
6567 - name : Install cosign
66- uses : sigstore/cosign-installer@d7543c93d881b35a8faa02e8e3605f69b7a1ce62 # v3.10 .0
68+ uses : sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0 .0
6769
6870 - name : Set image name
6971 id : image-name
7072 run : echo "value=ghcr.io/${{ github.repository }}" >> "$GITHUB_OUTPUT"
7173
7274 - name : Gather build metadata
7375 id : meta
74- uses : docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8 .0
76+ uses : docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10 .0
7577 with :
7678 images : |
7779 ${{ steps.image-name.outputs.value }}
9092 labels : |
9193 org.opencontainers.image.documentation=https://dexidp.io/docs/
9294
95+ # Multiple exporters are not supported yet
96+ # See https://github.com/moby/buildkit/pull/2760
97+ - name : Get version from git-version script
98+ id : version
99+ run : echo "value=$(bash ./scripts/git-version)" >> "$GITHUB_OUTPUT"
100+
93101 # Multiple exporters are not supported yet
94102 # See https://github.com/moby/buildkit/pull/2760
95103 - name : Determine build output
@@ -101,33 +109,34 @@ jobs:
101109 if_false : type=oci,dest=image.tar
102110
103111 - name : Login to GitHub Container Registry
104- uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6 .0
112+ uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7 .0
105113 with :
106114 registry : ghcr.io
107115 username : ${{ github.actor }}
108116 password : ${{ github.token }}
109117 if : inputs.publish
110118
111119 - name : Login to Docker Hub
112- uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6 .0
120+ uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7 .0
113121 with :
114122 username : ${{ secrets.DOCKER_USERNAME }}
115123 password : ${{ secrets.DOCKER_PASSWORD }}
116124 if : inputs.publish
117125
118126 - name : Build and push image
119127 id : build
120- uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
128+ uses : docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
121129 with :
122130 context : .
123131 platforms : linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
124132 tags : ${{ steps.meta.outputs.tags }}
125133 build-args : |
126134 BASE_IMAGE=${{ matrix.variant }}
127- VERSION=${{ fromJSON( steps.meta .outputs.json).labels['org.opencontainers.image.version'] }}
135+ VERSION=${{ steps.version .outputs.value }}
128136 COMMIT_HASH=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
129137 BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
130- labels : ${{ steps.meta.outputs.labels }}
138+ labels : |
139+ ${{ steps.meta.outputs.labels }}
131140 # cache-from: type=gha
132141 # cache-to: type=gha,mode=max
133142 outputs : ${{ steps.build-output.outputs.value }}
@@ -177,62 +186,73 @@ jobs:
177186
178187 # TODO: uncomment when the action is working for non ghcr.io pushes. GH Issue: https://github.com/actions/attest-build-provenance/issues/80
179188 # - name: Generate build provenance attestation
180- # uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0 .0
189+ # uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2 .0
181190 # with:
182191 # subject-name: dexidp/dex
183192 # subject-digest: ${{ steps.build.outputs.digest }}
184193 # push-to-registry: true
185194
186195 - name : Generate build provenance attestation
187- uses : actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0 .0
196+ uses : actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2 .0
188197 with :
189198 subject-name : ghcr.io/${{ github.repository }}
190199 subject-digest : ${{ steps.build.outputs.digest }}
191200 push-to-registry : true
192201 if : inputs.publish
193202
203+ - name : Prepare image fs for scanning
204+ run : |
205+ docker load --input image.tar
206+ docker export $(docker create --rm ${{ steps.image-name.outputs.value }}@${{ steps.build.outputs.digest }}) -o docker-image.tar
207+
208+ mkdir -p docker-image
209+ tar -xf docker-image.tar -C docker-image
210+
194211 # # Use cache for the trivy-db to avoid the TOOMANYREQUESTS error https://github.com/aquasecurity/trivy-action/pull/397
195212 # # To avoid the trivy-db becoming outdated, we save the cache for one day
196213 - name : Get data
197214 id : date
198215 run : echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT
199216
200217 - name : Restore trivy cache
201- uses : actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
218+ uses : actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
202219 with :
203220 path : cache/db
204221 key : trivy-cache-${{ steps.date.outputs.date }}
205222 restore-keys : trivy-cache-
206223
207224 - name : Run Trivy vulnerability scanner
208- uses : aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # 0.33.1
225+ uses : aquasecurity/trivy-action@c1824fd6edce30d7ab345a9989de00bbd46ef284 # 0.34.0
209226 with :
210- input : image
227+ input : docker- image
211228 format : sarif
212229 output : trivy-results.sarif
213- scan-type : " fs "
230+ scan-type : " rootfs "
214231 scan-ref : " ."
215232 cache-dir : " ./cache"
216233 # Disable skipping trivy cache for now
217- # env:
218- # TRIVY_SKIP_DB_UPDATE: true
219- # TRIVY_SKIP_JAVA_DB_UPDATE: true
234+ env :
235+ TRIVY_SKIP_DB_UPDATE : true
236+ TRIVY_SKIP_JAVA_DB_UPDATE : true
220237
221238 # # Trivy-db uses `0600` permissions.
222239 # # But `action/cache` use `runner` user by default
223240 # # So we need to change the permissions before caching the database.
224241 - name : change permissions for trivy.db
225242 run : sudo chmod 0644 ./cache/db/trivy.db
226243
244+ - name : Check Trivy sarif
245+ run : cat trivy-results.sarif
246+
227247 - name : Upload Trivy scan results as artifact
228- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
248+ uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
229249 with :
230250 name : " [${{ github.job }}] Trivy scan results"
231251 path : trivy-results.sarif
232252 retention-days : 5
233253 overwrite : true
234254
235255 - name : Upload Trivy scan results to GitHub Security tab
236- uses : github/codeql-action/upload-sarif@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v3.29.5
256+ uses : github/codeql-action/upload-sarif@9e907b5e64f6b83e7804b09294d44122997950d6 # v3.29.5
237257 with :
238258 sarif_file : trivy-results.sarif
0 commit comments