@@ -15,17 +15,28 @@ jobs:
1515 # Jobs organized for concurrent Docker image builds
1616 # Jobs build tagged and :latest images and push to Docker Hub
1717
18+ # This is a workaround to the limitation that an `env:` map cannot reference the `env:` map to create additional environment variables
19+ image-details :
20+ runs-on : ubuntu-latest
21+ steps :
22+ # A step must be present in order to make use of `outputs:`
23+ - run : echo "Setting Docker image details..."
24+ outputs :
25+ base-name : ' madsciencelab'
26+ base-url : ' throwtheswitch/madsciencelab'
27+
1828 madsciencelab :
1929 runs-on : ubuntu-latest
30+ needs : [image-details]
2031 permissions :
2132 contents : read
2233 packages : write
2334 attestations : write
2435 id-token : write
2536 env :
26- IMAGE_NAME : " ${{ env.IMAGE_BASE_NAME }}"
37+ IMAGE_NAME : ${{ needs.image-details.outputs.base-name }}
2738 # Cannot reference IMAGE_NAME as it does not exist yet
28- IMAGE_URL : " ${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }}-plugins "
39+ IMAGE_URL : ${{ needs.image-details.outputs.base-url }}
2940
3041 steps :
3142 - name : ' Checkout GitHub Action'
4657
4758 # Docker image: madsciencelab
4859 # Note: standard/ directory maps to madsciencelab image (no variants)
49- - name : ' Build and push Docker image ${{ env.IMAGE_BASE_NAME }}:${{ github.ref_name }}'
60+ - name : ' Build and push Docker image ${{ env.IMAGE_NAME }}:${{ github.ref_name }}'
5061 uses : docker/build-push-action@v6
5162 with :
5263 platforms : linux/amd64,linux/arm64
5970
6071 madsciencelab-plugins :
6172 runs-on : ubuntu-latest
73+ needs : [image-details]
6274 permissions :
6375 contents : read
6476 packages : write
6779 env :
6880 VARIANT : ' plugins'
6981 # Cannot reference VARIANT as it does not exist yet
70- IMAGE_NAME : " ${{ env.IMAGE_BASE_NAME }}-plugins"
82+ IMAGE_NAME : ${{ needs.image-details.outputs.base-name }}-plugins
7183 # Cannot reference IMAGE_NAME as it does not exist yet
72- IMAGE_URL : " ${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }}-plugins"
84+ IMAGE_URL : ${{ needs.image-details.outputs.base-url }}-plugins
7385
7486 steps :
7587 - name : ' Checkout GitHub Action'
89101 password : ${{ secrets.DOCKERHUB_TOKEN }}
90102
91103 # Docker image: madsciencelab-plugins
92- - name : ' Build and push Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:${{ github.ref_name }}'
104+ - name : ' Build and push Docker image ${{ env.IMAGE_NAME }}:${{ github.ref_name }}'
93105 uses : docker/build-push-action@v6
94106 with :
95107 platforms : linux/amd64,linux/arm64
@@ -102,6 +114,7 @@ jobs:
102114
103115 madsciencelab-arm-none-eabi :
104116 runs-on : ubuntu-latest
117+ needs : [image-details]
105118 permissions :
106119 contents : read
107120 packages : write
@@ -110,9 +123,9 @@ jobs:
110123 env :
111124 VARIANT : ' arm-none-eabi'
112125 # Cannot reference VARIANT as it does not exist yet
113- IMAGE_NAME : " ${{ env.IMAGE_BASE_NAME }}-arm-none-eabi"
126+ IMAGE_NAME : ${{ needs.image-details.outputs.base-name }}-arm-none-eabi
114127 # Cannot reference IMAGE_NAME as it does not exist yet
115- IMAGE_URL : " ${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }}-arm-none-eabi"
128+ IMAGE_URL : ${{ needs.image-details.outputs.base-url }}-arm-none-eabi
116129
117130 steps :
118131 - name : ' Checkout GitHub Action'
@@ -132,7 +145,7 @@ jobs:
132145 password : ${{ secrets.DOCKERHUB_TOKEN }}
133146
134147 # Docker image: madsciencelab-arm-none-eabi
135- - name : ' Build and push Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:${{ github.ref_name }}'
148+ - name : ' Build and push Docker image ${{ env.IMAGE_NAME }}:${{ github.ref_name }}'
136149 uses : docker/build-push-action@v6
137150 with :
138151 platforms : linux/amd64,linux/arm64
@@ -145,6 +158,7 @@ jobs:
145158
146159 madsciencelab-arm-none-eabi-plugins :
147160 runs-on : ubuntu-latest
161+ needs : [image-details]
148162 permissions :
149163 contents : read
150164 packages : write
@@ -153,9 +167,9 @@ jobs:
153167 env :
154168 VARIANT : ' arm-none-eabi-plugins'
155169 # Cannot reference VARIANT as it does not exist yet
156- IMAGE_NAME : " ${{ env.IMAGE_BASE_NAME }}-arm-none-eabi-plugins"
170+ IMAGE_NAME : ${{ needs.image-details.outputs.base-name }}-arm-none-eabi-plugins
157171 # Cannot reference IMAGE_NAME as it does not exist yet
158- IMAGE_URL : " ${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }}-arm-none-eabi-plugins"
172+ IMAGE_URL : ${{ needs.image-details.outputs.base-url }}-arm-none-eabi-plugins
159173
160174 steps :
161175 - name : ' Checkout GitHub Action'
@@ -175,7 +189,7 @@ jobs:
175189 password : ${{ secrets.DOCKERHUB_TOKEN }}
176190
177191 # Docker image: madsciencelab-arm-none-eabi-plugins
178- - name : ' Build and push Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:${{ github.ref_name }}'
192+ - name : ' Build and push Docker image ${{ env.IMAGE_NAME }}:${{ github.ref_name }}'
179193 uses : docker/build-push-action@v6
180194 with :
181195 platforms : linux/amd64,linux/arm64
0 commit comments