@@ -108,8 +108,6 @@ jobs:
108
108
- name : Evaluate Checks
109
109
id : evaluate_checks
110
110
run : |
111
- echo "::notice::# Preflight Checks"
112
-
113
111
if [[ "${{ env.tag_exists }}" == "true" ]]; then
114
112
echo "::error::FAIL: Container tag already exists"
115
113
export failBuild="true"
@@ -184,3 +182,46 @@ jobs:
184
182
exit-code : 1
185
183
severity : HIGH,CRITICAL
186
184
hide-progress : true
185
+
186
+ publish :
187
+ needs : [detect-changes]
188
+ if : ${{ needs.detect-changes.outputs.images != '[]' && github.ref == 'refs/heads/main' }}
189
+ name : Publish
190
+ runs-on : ubuntu-latest
191
+ permissions :
192
+ contents : read
193
+ id-token : write
194
+ packages : write
195
+ strategy :
196
+ fail-fast : false
197
+ matrix :
198
+ image : ${{ fromJson(needs.detect-changes.outputs.images) }}
199
+ steps :
200
+ - name : Checkout
201
+ id : checkout
202
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
203
+
204
+ - name : Set Up QEMU
205
+ id : setup_qemu
206
+ uses : docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
207
+
208
+ - name : Set Up Docker Buildx
209
+ id : setup_docker_buildx
210
+ uses : docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
211
+
212
+ - name : Prepare Environment
213
+ id : prepare_environment
214
+ run : |
215
+ version=$(jq -r '.version' images/${{ matrix.image }}/config.json)
216
+ echo "version=${version}" >>"${GITHUB_ENV}"
217
+
218
+ - name : Publish Image
219
+ uses : docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
220
+ with :
221
+ file : images/${{ matrix.image }}/Dockerfile
222
+ context : images/${{ matrix.image }}
223
+ platforms : linux/amd64,linux/arm64
224
+ push : true
225
+ tags : |
226
+ ghcr.io/ministryofjustice/devcontainer-${{ matrix.image }}:${{ env.version }}
227
+ ghcr.io/ministryofjustice/devcontainer-${{ matrix.image }}:latest
0 commit comments