Skip to content

Commit 241f6eb

Browse files
committed
Fixes bug that always built the same (default) image for all prebuilt GHCR images.
1 parent 21ea6d3 commit 241f6eb

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

.github/workflows/build-and-publish-docker-image.yml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ on:
3131
description: 'If true, then an additional tag without OS information is generated.'
3232
required: true
3333
type: boolean
34-
build_args:
34+
build_args_csv:
3535
description: 'String Array of comma separated build-args. Ex ["val1=1", "val2=2", "val3=3"] '
3636
required: false
3737
type: string
@@ -53,19 +53,13 @@ jobs:
5353
&& echo "TAG_RELEASE_AND_OS_CAMEL_CASE=${LOWER_CASE_MATLAB_RELEASE}-${{ inputs.os_info_tag }}" >> "$GITHUB_OUTPUT" \
5454
&& echo "TAG_RELEASE_AND_OS_PASCAL_CASE=${LOWER_CASE_MATLAB_RELEASE^}-${{ inputs.os_info_tag }}" >> "$GITHUB_OUTPUT"
5555
56-
- name: Create list of build args from array of strings
57-
id: build-args-as-list
58-
uses: lucaspinheirogit/[email protected]
56+
# List is defined as a New Line Separated set of values. See: https://github.com/docker/build-push-action?tab=readme-ov-file#inputs
57+
- name: Create New Line separated from Comma Separated
58+
id: convert-build-args-csv-to-list
59+
uses: actions/github-script@v7
5960
with:
60-
stringArray: ${{ inputs.build_args }}
61-
62-
# See here for example: https://docs.docker.com/build/ci/github-actions/push-multi-registries/
63-
# -
64-
# name: Login to Docker Hub
65-
# uses: docker/login-action@v2
66-
# with:
67-
# username: ${{ secrets.DOCKERHUB_USERNAME }}
68-
# password: ${{ secrets.DOCKERHUB_TOKEN }}
61+
script: |
62+
core.setOutput('build-args-as-list', `${{ inputs.build_args_csv }}`.split(",").join("\n"))
6963
7064
- name: Login to GitHub Container Registry
7165
uses: docker/login-action@v2
@@ -82,21 +76,22 @@ jobs:
8276
if: ${{ inputs.is_default_os == false }}
8377
uses: docker/build-push-action@v4
8478
with:
85-
build-args: ${{ steps.build-args-as-list.outputs.stringList }}
79+
build-args: |
80+
${{ steps.convert-build-args-csv-to-list.outputs.build-args-as-list }}
8681
context: ${{ inputs.docker_build_context }}
8782
platforms: linux/amd64
8883
push: true
8984
tags: |
9085
${{ inputs.base_image_name }}:${{ steps.setup_image_tags.outputs.TAG_RELEASE_AND_OS_CAMEL_CASE }}
9186
${{ inputs.base_image_name }}:${{ steps.setup_image_tags.outputs.TAG_RELEASE_AND_OS_PASCAL_CASE }}
92-
9387
9488
# Example tags: r2023a-ubuntu20.04, R2023a-ubuntu20.04, r2023a, R2023a
9589
- name: Build & Push Image for latest OS
9690
if: ${{ inputs.is_default_os == true }}
9791
uses: docker/build-push-action@v4
9892
with:
99-
build-args: ${{ steps.build-args-as-list.outputs.stringList }}
93+
build-args: |
94+
${{ steps.convert-build-args-csv-to-list.outputs.build-args-as-list }}
10095
context: ${{ inputs.docker_build_context }}
10196
platforms: linux/amd64
10297
push: true

.github/workflows/jupyter-matlab-notebook.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ jobs:
3232
os_info_tag: 'ubuntu22.04'
3333
matlab_release_tag: ${{ matrix.matlab_release_tag }}
3434
is_default_os: true
35-
build_args: '["MATLAB_RELEASE=${{ matrix.matlab_release_tag }}", "INSTALL_VNC=1", "INSTALL_MATLABENGINE=1", "MOUNT_MATLAB=1"]'
35+
build_args_csv: MATLAB_RELEASE=${{ matrix.matlab_release_tag }},INSTALL_VNC=1,INSTALL_MATLABENGINE=1

.github/workflows/jupyter-mounted-matlab-notebook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ jobs:
3232
os_info_tag: 'ubuntu22.04'
3333
matlab_release_tag: ${{ matrix.matlab_release_tag }}
3434
is_default_os: true
35-
build_args: '["MATLAB_RELEASE=${{ matrix.matlab_release_tag }}", "INSTALL_VNC=1", "INSTALL_MATLABENGINE=1", "MOUNT_MATLAB=1"]'
35+
build_args_csv: MATLAB_RELEASE=${{ matrix.matlab_release_tag }},INSTALL_VNC=1,INSTALL_MATLABENGINE=1,MOUNT_MATLAB=1

0 commit comments

Comments
 (0)