Skip to content

Commit d916e99

Browse files
committed
Fix
1 parent 7581010 commit d916e99

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
outputs:
1919
images:
2020
description: Images identified by digests
21-
value: ${{ jobs.build.outputs.images }}
21+
value: ${{ jobs.build.steps.set-output.outputs.result }}
2222

2323
jobs:
2424
build:
@@ -74,15 +74,24 @@ jobs:
7474
.github/workflows/env.hcl
7575
7676
- name: Set output variables
77+
id: set-output
7778
uses: actions/github-script@v7
7879
with:
7980
script: |
80-
const data = JSON.parse(process.env.BAKE_METADATA,'utf-8')
81-
for (const key in JSON.parse(process.env.BAKE_METADATA || '{}', 'utf-8')) {
82-
if (data.hasOwnProperty(key)) {
83-
const entry = data[key];
84-
core.setOutput(`${key.toUpperCase().replace(/-/g, "_")}_IMAGE`, `${entry["image.name"]}@${entry["containerimage.digest"]}`);
85-
}
81+
const bake_output = JSON.parse(process.env.BAKE_METADATA,'utf-8')
82+
images = {}
83+
for (const key in bake_output)) {
84+
const image = bake_output[key];
85+
console.log(key, image);
86+
// turn e.g. 'full-stack' to 'FULL_STACK_IMAGE' key
87+
const image_envvar = `${key.toUpperCase().replace(/-/g, "_")}_IMAGE`;
88+
// create full canonical path to the image using its digest, i.e.
89+
// ghcr.io/aiidalab/base@sha256:cdad93278a...
90+
const image_digest = `${image["image.name"]}@${image["containerimage.digest"]}`;
91+
images[image_envvar] = image_digest;
8692
}
93+
console.log(images);
94+
return images;
8795
env:
8896
BAKE_METADATA: ${{ steps.build-upload.outputs.metadata }}
97+
#- run: echo "images=${{steps.set-output.outputs.result}}" >> $GITHUB_ENV

0 commit comments

Comments
 (0)