|
18 | 18 | outputs: |
19 | 19 | images: |
20 | 20 | description: Images identified by digests |
21 | | - value: ${{ jobs.build.outputs.images }} |
| 21 | + value: ${{ jobs.build.steps.set-output.outputs.result }} |
22 | 22 |
|
23 | 23 | jobs: |
24 | 24 | build: |
@@ -74,15 +74,24 @@ jobs: |
74 | 74 | .github/workflows/env.hcl |
75 | 75 |
|
76 | 76 | - name: Set output variables |
| 77 | + id: set-output |
77 | 78 | uses: actions/github-script@v7 |
78 | 79 | with: |
79 | 80 | 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; |
86 | 92 | } |
| 93 | + console.log(images); |
| 94 | + return images; |
87 | 95 | env: |
88 | 96 | BAKE_METADATA: ${{ steps.build-upload.outputs.metadata }} |
| 97 | + #- run: echo "images=${{steps.set-output.outputs.result}}" >> $GITHUB_ENV |
0 commit comments