31
31
description : ' If true, then an additional tag without OS information is generated.'
32
32
required : true
33
33
type : boolean
34
- build_args :
34
+ build_args_csv :
35
35
description : ' String Array of comma separated build-args. Ex ["val1=1", "val2=2", "val3=3"] '
36
36
required : false
37
37
type : string
@@ -53,19 +53,13 @@ jobs:
53
53
&& echo "TAG_RELEASE_AND_OS_CAMEL_CASE=${LOWER_CASE_MATLAB_RELEASE}-${{ inputs.os_info_tag }}" >> "$GITHUB_OUTPUT" \
54
54
&& echo "TAG_RELEASE_AND_OS_PASCAL_CASE=${LOWER_CASE_MATLAB_RELEASE^}-${{ inputs.os_info_tag }}" >> "$GITHUB_OUTPUT"
55
55
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
59
60
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"))
69
63
70
64
- name : Login to GitHub Container Registry
71
65
uses : docker/login-action@v2
@@ -82,21 +76,22 @@ jobs:
82
76
if : ${{ inputs.is_default_os == false }}
83
77
uses : docker/build-push-action@v4
84
78
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 }}
86
81
context : ${{ inputs.docker_build_context }}
87
82
platforms : linux/amd64
88
83
push : true
89
84
tags : |
90
85
${{ inputs.base_image_name }}:${{ steps.setup_image_tags.outputs.TAG_RELEASE_AND_OS_CAMEL_CASE }}
91
86
${{ inputs.base_image_name }}:${{ steps.setup_image_tags.outputs.TAG_RELEASE_AND_OS_PASCAL_CASE }}
92
-
93
87
94
88
# Example tags: r2023a-ubuntu20.04, R2023a-ubuntu20.04, r2023a, R2023a
95
89
- name : Build & Push Image for latest OS
96
90
if : ${{ inputs.is_default_os == true }}
97
91
uses : docker/build-push-action@v4
98
92
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 }}
100
95
context : ${{ inputs.docker_build_context }}
101
96
platforms : linux/amd64
102
97
push : true
0 commit comments