@@ -18,24 +18,28 @@ jobs:
1818 # Jobs organized for concurrent Docker image builds
1919 # Jobs only build :latest images without pushing to Docker Hub
2020
21- # This is a self-documenting workaround to the limitation that the global `env:` context is not available to jobs' `env:` contexts
22- prepare-env-vars :
21+ # This is a workaround to the limitation that an `env:` map cannot reference the `env:` map to create additional environment variables
22+ image-details :
2323 runs-on : ubuntu-latest
2424 steps :
2525 # A step must be present in order to make use of `outputs:`
26- - run : echo "Setting environment variables shared by jobs ..."
26+ - run : echo "Setting Docker image details ..."
2727 outputs :
28- IMAGE_BASE_NAME : ${{ env.IMAGE_BASE_NAME }}
29- IMAGE_URL_BASE : ${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }}
28+ base-name : ' madsciencelab '
29+ base-url : ' throwtheswitch/madsciencelab '
3030
3131 madsciencelab :
3232 runs-on : ubuntu-latest
33- needs : [prepare-env-vars ]
33+ needs : [image-details ]
3434 permissions :
3535 contents : read
3636 packages : write
3737 attestations : write
3838 id-token : write
39+ env :
40+ IMAGE_NAME : ${{ needs.image-details.outputs.base-name }}
41+ # Cannot reference IMAGE_NAME as it does not exist yet
42+ IMAGE_URL : ${{ needs.image-details.outputs.base-url }}
3943
4044 steps :
4145 - name : ' Checkout GitHub Action'
@@ -56,19 +60,19 @@ jobs:
5660
5761 # Docker image: madsciencelab
5862 # Note: standard/ directory maps to madsciencelab image (no variants)
59- - name : ' Build Docker image ${{ env.IMAGE_BASE_NAME }}'
63+ - name : ' Build Docker image ${{ env.IMAGE_NAME }}'
6064 uses : docker/build-push-action@v6
6165 with :
6266 platforms : linux/amd64,linux/arm64
6367 file : build/standard/docker/Dockerfile
6468 build-args : |
6569 CONTAINER_VERSION=${{ github.ref_name }}
66- IMAGE_NAME=${{ env.IMAGE_BASE_NAME }}
67- tags : ${{ env.IMAGE_URL_BASE }}:latest
70+ IMAGE_NAME=${{ env.IMAGE_NAME }}
71+ tags : ${{ env.IMAGE_URL }}:latest
6872
6973 madsciencelab-plugins :
7074 runs-on : ubuntu-latest
71- needs : [prepare-env-vars ]
75+ needs : [image-details ]
7276 permissions :
7377 contents : read
7478 packages : write
7781 env :
7882 VARIANT : ' plugins'
7983 # Cannot reference VARIANT as it does not exist yet
80- IMAGE_NAME : ${{ env.IMAGE_BASE_NAME }}-plugins
84+ IMAGE_NAME : ${{ needs.image-details.outputs.base-name }}-plugins
8185 # Cannot reference IMAGE_NAME as it does not exist yet
82- IMAGE_URL : ${{ env.IMAGE_URL_BASE }}-plugins
86+ IMAGE_URL : ${{ needs.image-details.outputs.base-url }}-plugins
8387
8488 steps :
8589 - name : ' Checkout GitHub Action'
@@ -111,7 +115,7 @@ jobs:
111115
112116 madsciencelab-arm-none-eabi :
113117 runs-on : ubuntu-latest
114- needs : [prepare-env-vars ]
118+ needs : [image-details ]
115119 permissions :
116120 contents : read
117121 packages : write
@@ -120,9 +124,9 @@ jobs:
120124 env :
121125 VARIANT : ' arm-none-eabi'
122126 # Cannot reference VARIANT as it does not exist yet
123- IMAGE_NAME : ${{ env.IMAGE_BASE_NAME }}-arm-none-eabi
127+ IMAGE_NAME : ${{ needs.image-details.outputs.base-name }}-arm-none-eabi
124128 # Cannot reference IMAGE_NAME as it does not exist yet
125- IMAGE_URL : ${{ env.IMAGE_URL_BASE }}-arm-none-eabi
129+ IMAGE_URL : ${{ needs.image-details.outputs.base-url }}-arm-none-eabi
126130
127131 steps :
128132 - name : ' Checkout GitHub Action'
@@ -142,7 +146,7 @@ jobs:
142146 password : ${{ secrets.DOCKERHUB_TOKEN }}
143147
144148 # Docker image: madsciencelab-arm-none-eabi
145- - name : ' Build Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}'
149+ - name : ' Build Docker image ${{ env.IMAGE_NAME }}'
146150 uses : docker/build-push-action@v6
147151 with :
148152 platforms : linux/amd64,linux/arm64
@@ -154,7 +158,7 @@ jobs:
154158
155159 madsciencelab-arm-none-eabi-plugins :
156160 runs-on : ubuntu-latest
157- needs : [prepare-env-vars ]
161+ needs : [image-details ]
158162 permissions :
159163 contents : read
160164 packages : write
@@ -163,9 +167,9 @@ jobs:
163167 env :
164168 VARIANT : ' arm-none-eabi-plugins'
165169 # Cannot reference VARIANT as it does not exist yet
166- IMAGE_NAME : ${{ env.IMAGE_BASE_NAME }}-arm-none-eabi-plugins
170+ IMAGE_NAME : ${{ needs.image-details.outputs.base-name }}-arm-none-eabi-plugins
167171 # Cannot reference IMAGE_NAME as it does not exist yet
168- IMAGE_URL : ${{ env.IMAGE_URL_BASE }}-arm-none-eabi-plugins
172+ IMAGE_URL : ${{ needs.image-details.outputs.base-url }}-arm-none-eabi-plugins
169173
170174 steps :
171175 - name : ' Checkout GitHub Action'
@@ -185,7 +189,7 @@ jobs:
185189 password : ${{ secrets.DOCKERHUB_TOKEN }}
186190
187191 # Docker image: madsciencelab-arm-none-eabi-plugins
188- - name : ' Build Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}'
192+ - name : ' Build Docker image ${{ env.IMAGE_NAME }}'
189193 uses : docker/build-push-action@v6
190194 with :
191195 platforms : linux/amd64,linux/arm64
0 commit comments