Skip to content

Commit 8a082e7

Browse files
authored
Merge pull request #3098 from infrahq/mxyng/fix-build
fix(build): fix workflows for release
2 parents 6875ad8 + 5261c5b commit 8a082e7

File tree

2 files changed

+18
-24
lines changed

2 files changed

+18
-24
lines changed

.github/workflows/cd-binaries.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
needs: [prepare, build]
5656
if: ${{ startsWith(github.ref, 'refs/tags/') }}
5757
steps:
58+
- uses: actions/checkout@v3
5859
- uses: actions/download-artifact@v3
5960
with:
6061
name: binaries

.github/workflows/cd-containers.yaml

+17-24
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,29 @@ jobs:
2424
runs-on: ubuntu-latest
2525
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
2626
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 }}
3028
steps:
31-
- id: component-name
29+
- id: components
3230
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
4437
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"
4939
5040
build:
5141
runs-on: ubuntu-latest
5242
needs: [prepare]
5343
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
44+
strategy:
45+
matrix:
46+
component: ${{ fromJson(needs.prepare.outputs.components) }}
5447
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 }}
5750
steps:
5851
- uses: actions/checkout@v3
5952
- uses: docker/login-action@v2
@@ -86,12 +79,13 @@ jobs:
8679
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
8780
strategy:
8881
matrix:
82+
component: ${{ fromJson(needs.prepare.outputs.components) }}
8983
environment:
9084
- name: Development
9185
- name: Production
9286
environment: ${{ matrix.environment.name }}
9387
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 }}
9589
cancel-in-progress: true
9690
steps:
9791
- uses: actions/checkout@v3
@@ -105,5 +99,4 @@ jobs:
10599
argocd-tools: |
106100
argocd-image-updater
107101
- 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

Comments
 (0)