@@ -22,24 +22,6 @@ permissions:
2222 contents : read # to fetch code (actions/checkout)
2323
2424jobs :
25- prepare :
26- runs-on : ubuntu-latest
27- outputs :
28- matrix : ${{ steps.platforms.outputs.matrix }}
29- steps :
30- -
31- name : Checkout
32- uses : actions/checkout@v4
33- -
34- name : Create matrix
35- id : platforms
36- run : |
37- echo matrix=$(docker buildx bake binary-cross --print | jq -cr '.target."binary-cross".platforms') >> $GITHUB_OUTPUT
38- -
39- name : Show matrix
40- run : |
41- echo ${{ steps.platforms.outputs.matrix }}
42-
4325 validate :
4426 runs-on : ubuntu-latest
4527 strategy :
@@ -53,100 +35,126 @@ jobs:
5335 steps :
5436 -
5537 name : Checkout
56- uses : actions/checkout@v4
38+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
5739 -
5840 name : Set up Docker Buildx
59- uses : docker/setup-buildx-action@v3
41+ uses : docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
6042 -
6143 name : Run
6244 run : |
6345 make ${{ matrix.target }}
6446
6547 binary :
48+ uses : docker/github-builder/.github/workflows/bake.yml@70313223e2665c3211b454b3fea6534624e78d64 # v1.4.0
49+ permissions :
50+ contents : read # same as global permission
51+ id-token : write # for signing attestation(s) with GitHub OIDC Token
52+ with :
53+ runner : amd64
54+ artifact-name : compose
55+ artifact-upload : true
56+ cache : true
57+ cache-scope : binary
58+ target : release
59+ output : local
60+ sbom : true
61+ sign : ${{ github.event_name != 'pull_request' }}
62+
63+ binary-finalize :
6664 runs-on : ubuntu-latest
6765 needs :
68- - prepare
69- strategy :
70- fail-fast : false
71- matrix :
72- platform : ${{ fromJson(needs.prepare.outputs.matrix) }}
66+ - binary
7367 steps :
7468 -
75- name : Checkout
76- uses : actions/checkout@v4
77- -
78- name : Prepare
79- run : |
80- platform=${MATRIX_PLATFORM}
81- echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
82- env :
83- MATRIX_PLATFORM : ${{ matrix.platform }}
84- -
85- name : Set up QEMU
86- uses : docker/setup-qemu-action@v3
87- -
88- name : Set up Docker Buildx
89- uses : docker/setup-buildx-action@v3
90- -
91- name : Build
92- uses : docker/bake-action@v6
69+ name : Download artifacts
70+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
9371 with :
94- source : .
95- targets : release
96- provenance : mode=max
97- sbom : true
98- set : |
99- *.platform=${{ matrix.platform }}
100- *.cache-from=type=gha,scope=binary-${{ env.PLATFORM_PAIR }}
101- *.cache-to=type=gha,scope=binary-${{ env.PLATFORM_PAIR }},mode=max
72+ path : /tmp/compose-output
73+ name : ${{ needs.binary.outputs.artifact-name }}
10274 -
10375 name : Rename provenance and sbom
104- working-directory : ./bin/release
10576 run : |
106- binname=$(find . -name 'docker-compose-*')
107- filename=$(basename "$binname" | sed -E 's/\.exe$//')
108- mv "provenance.json" "${filename}.provenance.json"
109- mv "sbom-binary.spdx.json" "${filename}.sbom.json"
110- find . -name 'sbom*.json' -exec rm {} \;
77+ for pdir in /tmp/compose-output/*/; do
78+ (
79+ cd "$pdir"
80+ binname=$(find . -name 'docker-compose-*')
81+ filename=$(basename "${binname%.exe}")
82+ mv "provenance.json" "${filename}.provenance.json"
83+ mv "sbom-binary.spdx.json" "${filename}.sbom.json"
84+ find . -name 'sbom*.json' -exec rm {} \;
85+ if [ -f "provenance.sigstore.json" ]; then
86+ mv "provenance.sigstore.json" "${filename}.sigstore.json"
87+ fi
88+ )
89+ done
90+ mkdir -p "./bin/release"
91+ mv /tmp/compose-output/**/* "./bin/release/"
11192 -
112- name : List artifacts
93+ name : Create checksum file
94+ working-directory : ./bin/release
11395 run : |
114- tree -nh ./bin/release
96+ find . -type f -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# \*\./# *#' > $RUNNER_TEMP/checksums.txt
97+ shasum -a 256 -U -c $RUNNER_TEMP/checksums.txt
98+ mv $RUNNER_TEMP/checksums.txt .
99+ cat checksums.txt | while read sum file; do
100+ if [[ "${file#\*}" == docker-compose-* && "${file#\*}" != *.provenance.json && "${file#\*}" != *.sbom.json && "${file#\*}" != *.sigstore.json ]]; then
101+ echo "$sum $file" > ${file#\*}.sha256
102+ fi
103+ done
115104 -
116105 name : Upload artifacts
117- uses : actions/upload-artifact@v4
106+ uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
118107 with :
119- name : compose-${{ env.PLATFORM_PAIR }}
120- path : ./bin/release
108+ name : release
109+ path : ./bin/release/*
121110 if-no-files-found : error
122111
112+ bin-image-test :
113+ if : github.event_name == 'pull_request'
114+ uses : docker/github-builder/.github/workflows/bake.yml@70313223e2665c3211b454b3fea6534624e78d64 # v1.4.0
115+ with :
116+ runner : amd64
117+ target : image-cross
118+ cache : true
119+ cache-scope : bin-image-test
120+ output : image
121+ push : false
122+ sbom : true
123+ set-meta-labels : true
124+ meta-images : |
125+ compose-bin
126+ meta-tags : |
127+ type=ref,event=pr
128+ meta-bake-target : meta-helper
129+
123130 test :
124131 runs-on : ubuntu-latest
125132 steps :
126133 -
127134 name : Set up Docker Buildx
128- uses : docker/setup-buildx-action@v3
135+ uses : docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
129136 -
130137 name : Test
131- uses : docker/bake-action@v6
138+ uses : docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7
132139 with :
133140 targets : test
134141 set : |
135142 *.cache-from=type=gha,scope=test
136143 *.cache-to=type=gha,scope=test
137144 -
138145 name : Gather coverage data
139- uses : actions/upload-artifact@v4
146+ uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
140147 with :
141148 name : coverage-data-unit
142149 path : bin/coverage/unit/
143150 if-no-files-found : error
144151 -
145152 name : Unit Test Summary
146- uses : test-summary/action@v2
153+ uses : test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4
147154 with :
148155 paths : bin/coverage/unit/report.xml
149156 if : always()
157+
150158 e2e :
151159 runs-on : ubuntu-latest
152160 name : e2e (${{ matrix.mode }}, ${{ matrix.channel }})
@@ -177,7 +185,7 @@ jobs:
177185 echo "MODE_ENGINE_PAIR=${mode}-${engine}" >> $GITHUB_ENV
178186
179187 - name : Checkout
180- uses : actions/checkout@v4
188+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
181189
182190 - name : Install Docker ${{ matrix.engine }}
183191 run : |
@@ -191,15 +199,15 @@ jobs:
191199 run : docker --version
192200
193201 - name : Set up Docker Buildx
194- uses : docker/setup-buildx-action@v3
202+ uses : docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
195203
196204 - name : Set up Docker Model
197205 run : |
198206 sudo apt-get install docker-model-plugin
199207 docker model version
200208
201209 - name : Set up Go
202- uses : actions/setup-go@v6
210+ uses : actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
203211 with :
204212 go-version-file : ' .go-version'
205213 check-latest : true
@@ -209,7 +217,7 @@ jobs:
209217 run : make example-provider
210218
211219 - name : Build
212- uses : docker/bake-action@v6
220+ uses : docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7
213221 with :
214222 source : .
215223 targets : binary-with-coverage
@@ -222,7 +230,7 @@ jobs:
222230
223231 - name : Setup tmate session
224232 if : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
225- uses : mxschmitt/action-tmate@8b4e4ac71822ed7e0ad5fb3d1c33483e9e8fb270 # v3.11
233+ uses : mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 # v3.23
226234 with :
227235 limit-access-to-actor : true
228236 github-token : ${{ secrets.GITHUB_TOKEN }}
@@ -236,7 +244,7 @@ jobs:
236244
237245 - name : Gather coverage data
238246 if : ${{ matrix.mode == 'plugin' }}
239- uses : actions/upload-artifact@v4
247+ uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
240248 with :
241249 name : coverage-data-e2e-${{ env.MODE_ENGINE_PAIR }}
242250 path : bin/coverage/e2e/
@@ -250,10 +258,11 @@ jobs:
250258 make e2e-compose-standalone
251259
252260 - name : e2e Test Summary
253- uses : test-summary/action@v2
261+ uses : test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4
254262 with :
255263 paths : /tmp/report/report.xml
256264 if : always()
265+
257266 coverage :
258267 runs-on : ubuntu-latest
259268 needs :
@@ -262,20 +271,20 @@ jobs:
262271 steps :
263272 # codecov won't process the report without the source code available
264273 - name : Checkout
265- uses : actions/checkout@v4
274+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
266275 - name : Set up Go
267- uses : actions/setup-go@v6
276+ uses : actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
268277 with :
269278 go-version-file : ' .go-version'
270279 check-latest : true
271280 - name : Download unit test coverage
272- uses : actions/download-artifact@v4
281+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
273282 with :
274283 name : coverage-data-unit
275284 path : coverage/unit
276285 merge-multiple : true
277286 - name : Download E2E test coverage
278- uses : actions/download-artifact@v4
287+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
279288 with :
280289 pattern : coverage-data-e2e-*
281290 path : coverage/e2e
@@ -284,46 +293,32 @@ jobs:
284293 run : |
285294 go tool covdata textfmt -i=./coverage/unit,./coverage/e2e -o ./coverage.txt
286295 - name : Store coverage report in GitHub Actions
287- uses : actions/upload-artifact@v4
296+ uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
288297 with :
289298 name : go-covdata-txt
290299 path : ./coverage.txt
291300 if-no-files-found : error
292301 - name : Upload coverage to Codecov
293- uses : codecov/codecov-action@v5
302+ uses : codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5.5.3
294303 with :
295304 files : ./coverage.txt
296305
297306 release :
298307 permissions :
299308 contents : write # to create a release (ncipollo/release-action)
300-
301309 runs-on : ubuntu-latest
302310 needs :
303- - binary
311+ - binary-finalize
304312 steps :
305313 -
306314 name : Checkout
307- uses : actions/checkout@v4
315+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
308316 -
309317 name : Download artifacts
310- uses : actions/download-artifact@v4
318+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
311319 with :
312- pattern : compose-*
313320 path : ./bin/release
314- merge-multiple : true
315- -
316- name : Create checksums
317- working-directory : ./bin/release
318- run : |
319- find . -type f -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# \*\./# *#' > $RUNNER_TEMP/checksums.txt
320- shasum -a 256 -U -c $RUNNER_TEMP/checksums.txt
321- mv $RUNNER_TEMP/checksums.txt .
322- cat checksums.txt | while read sum file; do
323- if [[ "${file#\*}" == docker-compose-* && "${file#\*}" != *.provenance.json && "${file#\*}" != *.sbom.json ]]; then
324- echo "$sum $file" > ${file#\*}.sha256
325- fi
326- done
321+ name : release
327322 -
328323 name : List artifacts
329324 run : |
@@ -335,7 +330,7 @@ jobs:
335330 -
336331 name : GitHub Release
337332 if : startsWith(github.ref, 'refs/tags/v')
338- uses : ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37 # v1.10 .0
333+ uses : ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21 .0
339334 with :
340335 artifacts : ./bin/release/*
341336 generateReleaseNotes : true
0 commit comments