Skip to content

Commit 7f16807

Browse files
committed
chore: try to get json formatting correct
1 parent 2be76f4 commit 7f16807

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

.github/workflows/dockerhub-release-matrix.yml

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ jobs:
6161
matrix: ${{ fromJson(needs.prepare.outputs.matrix_config) }}
6262
runs-on: ubuntu-latest
6363
outputs:
64-
versions: ${{ steps.output-versions.outputs.versions }}
65-
image_tags: ${{ steps.output-versions.outputs.image_tags }}
66-
build_args: ${{ steps.args.outputs.result }}
64+
matrix: ${{ steps.set-matrix.outputs.matrix }}
6765
steps:
6866
- uses: actions/checkout@v3
6967

@@ -87,23 +85,33 @@ jobs:
8785
with:
8886
cmd: yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' 'ansible/vars.yml'
8987

90-
- id: output-versions
88+
- id: set-matrix
9189
run: |
92-
# Create JSON arrays for versions and image tags
93-
echo "versions=$(echo '${{ toJSON(matrix.version) }}')" >> $GITHUB_OUTPUT
94-
echo "image_tags=$(echo 'supabase/postgres:${{ steps.settings.outputs.postgres-version }}')" >> $GITHUB_OUTPUT
90+
# Create a JSON object for the matrix
91+
MATRIX="{\"include\":["
92+
93+
# For each architecture
94+
for arch in "amd64" "arm64"; do
95+
runner="[\"self-hosted\", \"X64\"]"
96+
[ "$arch" = "arm64" ] && runner="arm-runner"
97+
98+
# Add the version details
99+
if [ "$arch" = "amd64" ]; then
100+
MATRIX+="{\"version\":\"${{ matrix.version }}\",\"image_tag\":\"supabase/postgres:${{ steps.settings.outputs.postgres-version }}\",\"arch\":\"$arch\",\"runner\":$runner}"
101+
else
102+
MATRIX+=",{\"version\":\"${{ matrix.version }}\",\"image_tag\":\"supabase/postgres:${{ steps.settings.outputs.postgres-version }}\",\"arch\":\"$arch\",\"runner\":$runner}"
103+
fi
104+
done
105+
106+
MATRIX+="]}"
107+
108+
# Output the matrix
109+
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
95110
96111
build_release_image:
97-
needs: [build]
112+
needs: build
98113
strategy:
99-
matrix:
100-
version: ${{ fromJson(needs.build.outputs.versions) }}
101-
image_tag: ${{ fromJson(needs.build.outputs.image_tags) }}
102-
include:
103-
- arch: amd64
104-
runner: [self-hosted, X64]
105-
- arch: arm64
106-
runner: arm-runner
114+
matrix: ${{ fromJson(needs.build.outputs.matrix) }}
107115
runs-on: ${{ matrix.runner }}
108116
timeout-minutes: 180
109117
steps:
@@ -138,10 +146,9 @@ jobs:
138146
SLACK_FOOTER: ""
139147

140148
merge_manifest:
141-
needs: [build, build_release_image]
149+
needs: [build]
142150
strategy:
143-
matrix:
144-
image_tag: ${{ fromJson(needs.build.outputs.image_tags) }}
151+
matrix: ${{ fromJson(needs.build.outputs.matrix) }}
145152
runs-on: ubuntu-latest
146153
steps:
147154
- uses: docker/setup-buildx-action@v3

0 commit comments

Comments
 (0)