12
12
outputs :
13
13
metadata-filepath : ${{ steps.retrieve.outputs.metadata-filepath }}
14
14
metadata-json : ${{ steps.retrieve.outputs.metadata-json }}
15
+ # from-source-metadata-filepath is the path to a file containing a subset
16
+ # of metadata-json entries for NON-compiled dependencies
17
+ from-source-metadata-filepath : ${{ steps.retrieve.outputs.from-source-metadata-filepath }}
15
18
# compilation-json is a subset of metadata-json entries which are missing
16
19
# a `checksum` and `uri`
17
20
compilation-json : ${{ steps.retrieve.outputs.compilation-json }}
@@ -20,17 +23,21 @@ jobs:
20
23
compilation-length : ${{ steps.retrieve.outputs.compilation-length }}
21
24
steps :
22
25
- name : Check out code
23
- uses : actions/checkout@v3
26
+ uses : actions/checkout@v4
24
27
25
28
- name : Setup Go
26
- uses : actions/setup-go@v3
29
+ uses : actions/setup-go@v5
27
30
with :
28
31
go-version : ' stable'
29
32
30
33
- name : Run Retrieve
31
34
id : retrieve
32
35
working-directory : dependency
33
36
run : |
37
+ #!/usr/bin/env bash
38
+ set -euo pipefail
39
+ shopt -s inherit_errexit
40
+
34
41
OUTPUT="/tmp/metadata.json"
35
42
36
43
make retrieve \
44
51
45
52
compilation=$(echo $content | jq -r 'map(select(.checksum == null and .uri == null))'?)
46
53
complength=$(echo $compilation | jq -r '. | length')
54
+ echo $content | jq -r 'map(select(.checksum != null and .uri != null))'? > "/tmp/from-source-metadata.json"
55
+ echo "from-source-metadata-filepath=/tmp/from-source-metadata.json" >> "$GITHUB_OUTPUT"
56
+
47
57
48
58
delimiter="$(uuidgen)"
49
59
echo "metadata-filepath=${OUTPUT}" >> "$GITHUB_OUTPUT"
@@ -55,11 +65,17 @@ jobs:
55
65
56
66
57
67
- name: Upload `${{ steps.retrieve.outputs.metadata-filepath }}`
58
- uses: actions/upload-artifact@v3
68
+ uses: actions/upload-artifact@v4
59
69
with:
60
70
name: metadata.json
61
71
path: ${{ steps.retrieve.outputs.metadata-filepath }}
62
72
73
+ - name: Upload `${{ steps.retrieve.outputs.from-source-metadata-filepath }}`
74
+ uses: actions/upload-artifact@v4
75
+ with:
76
+ name: from-source-metadata.json
77
+ path: ${{ steps.retrieve.outputs.from-source-metadata-filepath }}
78
+
63
79
# Check if there is buildpack-provided compilation code and testing code
64
80
# Optional compilation code expected at: <buildpack>/dependency/actions/compile/
65
81
# Optional testing code expected at: <buildpack>/dependency/test/
71
87
runs-on: ubuntu-latest
72
88
steps:
73
89
- name: Check out code
74
- uses: actions/checkout@v3
90
+ uses: actions/checkout@v4
75
91
76
92
- name: Has Compilation Action?
77
93
id: compile-check
@@ -106,19 +122,22 @@ jobs:
106
122
runs-on: ubuntu-latest
107
123
steps:
108
124
- name: Check out code
109
- uses: actions/checkout@v3
125
+ uses: actions/checkout@v4
110
126
111
127
- name: Make Temporary Artifact Directory
112
128
id: make-outputdir
113
- run: |
114
- echo "outputdir=$(mktemp -d)" >> "$GITHUB_OUTPUT"
129
+ run: echo "outputdir=$(mktemp -d)" >> "$GITHUB_OUTPUT"
115
130
116
131
# Download the tarball for testing if:
117
132
# (1) dependency testing code is present in the buildpack directory
118
133
# (2) URI in metadata.json is available
119
134
- name: Download upstream tarball (if not compiled)
120
135
if: ${{ matrix.includes.uri != '' && needs.get-compile-and-test.outputs.should-test == 'true' }}
121
136
run: |
137
+ #!/usr/bin/env bash
138
+ set -euo pipefail
139
+ shopt -s inherit_errexit
140
+
122
141
curl ${{ matrix.includes.uri }} \
123
142
--fail-with-body \
124
143
--show-error \
@@ -135,7 +154,6 @@ jobs:
135
154
make test \
136
155
version="${{ matrix.includes.version }}" \
137
156
tarballPath="${{ steps.make-outputdir.outputs.outputdir }}/*.tgz"
138
-
139
157
compile:
140
158
name: Compile and Test Dependency
141
159
needs:
@@ -153,7 +171,7 @@ jobs:
153
171
runs-on: ubuntu-latest
154
172
steps:
155
173
- name: Check out code
156
- uses: actions/checkout@v3
174
+ uses: actions/checkout@v4
157
175
158
176
- name: Make Temporary Artifact Directory
159
177
id: make-outputdir
@@ -175,7 +193,7 @@ jobs:
175
193
176
194
# If compiled, upload the tarball and checksum file for usage in the Update metadata job
177
195
- name: Upload workflow asset
178
- uses: actions/upload-artifact@v3
196
+ uses: actions/upload-artifact@v4
179
197
if: ${{ needs.get-compile-and-test.outputs.should-compile && matrix.includes.checksum == '' && matrix.includes.uri == '' }}
180
198
with:
181
199
name: '${{ needs.retrieve.outputs.id }}-${{ matrix.includes.version }}-${{ matrix.includes.target }}'
@@ -187,6 +205,10 @@ jobs:
187
205
working-directory: dependency
188
206
if: ${{ needs.get-compile-and-test.outputs.should-test == 'true' }}
189
207
run: |
208
+ #!/usr/bin/env bash
209
+ set -euo pipefail
210
+ shopt -s inherit_errexit
211
+
190
212
make test \
191
213
version="${{ matrix.includes.version }}" \
192
214
tarballPath="${{ steps.make-outputdir.outputs.outputdir }}/*.tgz"
@@ -201,23 +223,24 @@ jobs:
201
223
strategy:
202
224
matrix:
203
225
includes: ${{ fromJSON(needs.retrieve.outputs.compilation-json) }}
204
- # Run metadata update step sequentially so that metadata.json can be
205
- # modified for each version
206
- max-parallel: 1
207
226
if: ${{ needs.retrieve.outputs.compilation-length > 0 && needs.get-compile-and-test.outputs.should-compile == 'true' }}
208
227
runs-on: ubuntu-latest
209
228
steps:
210
229
- name: Check out code
211
- uses: actions/checkout@v3
230
+ uses: actions/checkout@v4
212
231
213
232
- name: Download artifact files
214
- uses: actions/download-artifact@v3
233
+ uses: actions/download-artifact@v4
215
234
with:
216
235
name: '${{ needs.retrieve.outputs.id }}-${{ matrix.includes.version }}-${{ matrix.includes.target }}'
217
236
218
237
- name: Get artifact file name
219
238
id: get-file-names
220
239
run: |
240
+ #!/usr/bin/env bash
241
+ set -euo pipefail
242
+ shopt -s inherit_errexit
243
+
221
244
echo "artifact-file=$(basename ./*.tgz)" >> "$GITHUB_OUTPUT"
222
245
echo "checksum-file=$(basename ./*.tgz.checksum)" >> "$GITHUB_OUTPUT"
223
246
@@ -241,10 +264,23 @@ jobs:
241
264
run: echo "checksum=$(cat ${{ steps.get-file-names.outputs.checksum-file }})" >> "$GITHUB_OUTPUT"
242
265
243
266
- name: Download metadata.json
244
- uses: actions/download-artifact@v3
267
+ uses: actions/download-artifact@v4
245
268
with:
246
269
name: metadata.json
247
270
271
+ # Create target/version specific metadata files
272
+ # Due to limitations with the upload action, we can no longer modify/upload the same metadata file
273
+ - name: Write dependency-specific metadata to new file
274
+ id: dependency-metadata
275
+ run: |
276
+ #!/usr/bin/env bash
277
+ set -euo pipefail
278
+ shopt -s inherit_errexit
279
+
280
+ metadata_file_name="${{ matrix.includes.target }}-${{ matrix.includes.version }}-metadata-file.json"
281
+ cat metadata.json | jq -r ['.[] | select( .version == "${{ matrix.includes.version }}" and .target == "${{ matrix.includes.target }}")'] > $metadata_file_name
282
+ echo "file=$(echo $metadata_file_name)" >> "$GITHUB_OUTPUT"
283
+
248
284
- name: Update `checksum` and `uri` in metadata for ${{ matrix.includes.target }} ${{ matrix.includes.version }}
249
285
if: ${{ matrix.includes.checksum == '' && matrix.includes.uri == '' }}
250
286
uses: paketo-buildpacks/github-config/actions/dependency/update-metadata-json@main
@@ -253,13 +289,13 @@ jobs:
253
289
target: ${{ matrix.includes.target }}
254
290
checksum: ${{ steps.get-checksum.outputs.checksum }}
255
291
uri: ${{ steps.upload.outputs.dependency-uri }}
256
- file: " metadata.json"
292
+ file: ${{ steps.dependency- metadata.outputs.file }}
257
293
258
294
- name: Upload modified metadata
259
- uses: actions/upload-artifact@v3
295
+ uses: actions/upload-artifact@v4
260
296
with:
261
- name: " metadata.json"
262
- path: " metadata.json"
297
+ name: ${{ steps.dependency- metadata.outputs.file }}
298
+ path: ${{ steps.dependency- metadata.outputs.file }}
263
299
264
300
assemble:
265
301
name: Update buildpack.toml
@@ -277,7 +313,7 @@ jobs:
277
313
runs-on: ubuntu-latest
278
314
steps:
279
315
- name: Check out code
280
- uses: actions/checkout@v3
316
+ uses: actions/checkout@v4
281
317
282
318
- name: Checkout Branch
283
319
uses: paketo-buildpacks/github-config/actions/pull-request/checkout-branch@main
@@ -286,14 +322,35 @@ jobs:
286
322
287
323
- name: Make Temporary Artifact Directory
288
324
id: make-outputdir
289
- run: |
290
- echo "outputdir=$(mktemp -d)" >> "$GITHUB_OUTPUT"
325
+ run: echo "outputdir=$(mktemp -d)" >> "$GITHUB_OUTPUT"
291
326
292
- - name: Download metadata.json
293
- uses: actions/download-artifact@v3
327
+
328
+ # Metadata file for the non-compiled dependencies, if there are any
329
+ - name: Download metadata.json file
330
+ uses: actions/download-artifact@v4
294
331
with:
295
- name: metadata.json
296
- path: "${{ steps.make-outputdir.outputs.outputdir }}"
332
+ path: "${{ steps.make-outputdir.outputs.outputdir }}/metadata-files"
333
+ pattern: "from-source-metadata.json"
334
+ merge-multiple: true
335
+
336
+ # If we compiled the dependency, and updated the metadata:
337
+ # Download each metadata file, and combine them into one
338
+ - name: Download individual metadata-file.json file(s)
339
+ if: ${{ needs.update-metadata.result == 'success' }}
340
+ uses: actions/download-artifact@v4
341
+ with:
342
+ path: "${{ steps.make-outputdir.outputs.outputdir }}/metadata-files"
343
+ pattern: "*metadata-file.json"
344
+ merge-multiple: true
345
+ - name: Display Metadata Files
346
+ run: ls "${{ steps.make-outputdir.outputs.outputdir }}/metadata-files"
347
+ - name: Combine Metadata Files
348
+ run: |
349
+ #!/usr/bin/env bash
350
+ set -euo pipefail
351
+ shopt -s inherit_errexit
352
+
353
+ jq -s 'add' ${{ steps.make-outputdir.outputs.outputdir }}/metadata-files/* > "${{ steps.make-outputdir.outputs.outputdir }}/metadata.json"
297
354
298
355
- name: Update dependencies from metadata.json
299
356
id: update
0 commit comments