@@ -24,36 +24,29 @@ jobs:
24
24
runs-on : ubuntu-latest
25
25
if : ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
26
26
outputs :
27
- component-name : ${{ steps.component-name.outputs.component-name }}
28
- container-image-name : ${{ steps.component-name.outputs.container-image-name }}
29
- container-image-context : ${{ steps.component-name.outputs.container-image-context }}
27
+ components : ${{ steps.components.outputs.components }}
30
28
steps :
31
- - id : component-name
29
+ - id : components
32
30
run : |
33
- COMPONENT_NAME=$(echo ${{ github.event_name == 'workflow_run' && github.event.workflow_run.name || inputs.component-name }} | awk '{ print $NF }' )
34
- if [ "$COMPONENT_NAME" = "core" ]; then
35
- CONTAINER_IMAGE_NAME='infrahq/infra'
36
- CONTAINER_IMAGE_CONTEXT='.'
37
- elif [ "$COMPONENT_NAME" = "ui" ]; then
38
- CONTAINER_IMAGE_NAME='infrahq/ui'
39
- CONTAINER_IMAGE_CONTEXT='ui'
40
- else
41
- echo Missing Infra component name.
42
- exit 1
43
- fi
31
+ COMPONENT_NAME=$(echo ${{ github.event_name == 'workflow_run' && github.event.workflow_run.name || inputs.component-name }} | awk '{ print $NF }')
32
+ case $COMPONENT_NAME in
33
+ core) COMPONENTS='[{"name":"core","container-image-name":"infrahq/infra","container-image-context":"."}]' ;;
34
+ ui) COMPONENTS='[{"name":"ui","container-image-name":"infrahq/ui","container-image-context":"ui"}]' ;;
35
+ *) COMPONENTS='[{"name":"core","container-image-name":"infrahq/infra","container-image-context":"."},{"name":"ui","container-image-name":"infrahq/ui","container-image-context":"ui"}]' ;;
36
+ esac
44
37
45
- echo "::notice ::Infra component name $COMPONENT_NAME"
46
- echo "::set-output name=component-name::$COMPONENT_NAME"
47
- echo "::set-output name=container-image-name::$CONTAINER_IMAGE_NAME"
48
- echo "::set-output name=container-image-context::$CONTAINER_IMAGE_CONTEXT"
38
+ echo "::set-output name=components::$COMPONENTS"
49
39
50
40
build :
51
41
runs-on : ubuntu-latest
52
42
needs : [prepare]
53
43
if : ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
44
+ strategy :
45
+ matrix :
46
+ component : ${{ fromJson(needs.prepare.outputs.components) }}
54
47
env :
55
- IMAGE : ${{ needs.prepare.outputs .container-image-name }}
56
- CONTEXT : ${{ needs.prepare.outputs .container-image-context }}
48
+ IMAGE : ${{ matrix.component .container-image-name }}
49
+ CONTEXT : ${{ matrix.component .container-image-context }}
57
50
steps :
58
51
- uses : actions/checkout@v3
59
52
- uses : docker/login-action@v2
@@ -86,12 +79,13 @@ jobs:
86
79
if : ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
87
80
strategy :
88
81
matrix :
82
+ component : ${{ fromJson(needs.prepare.outputs.components) }}
89
83
environment :
90
84
- name : Development
91
85
- name : Production
92
86
environment : ${{ matrix.environment.name }}
93
87
concurrency :
94
- group : ${{ github.workflow }}-synchronize-${{ matrix.environment.name }}-${{ needs.prepare.outputs. component- name }}
88
+ group : ${{ github.workflow }}-synchronize-${{ matrix.environment.name }}-${{ matrix. component. name }}
95
89
cancel-in-progress : true
96
90
steps :
97
91
- uses : actions/checkout@v3
105
99
argocd-tools : |
106
100
argocd-image-updater
107
101
- run : |
108
- echo Syncing Infra component-name ${{ needs.prepare.outputs.component-name }}
109
- argocd-image-updater run --once --match-application-label=ci.infrahq.com/component=${{ needs.prepare.outputs.component-name }}
102
+ argocd-image-updater run --once --match-application-label=ci.infrahq.com/component=${{ matrix.component.name }}
0 commit comments