Skip to content

Commit 6ce3238

Browse files
committed
chore: try to build up json over iterations
1 parent 60b2ea2 commit 6ce3238

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

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

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ jobs:
128128
include: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
129129
runs-on: ubuntu-latest
130130
outputs:
131-
tags: ${{ steps.combine_tags.outputs.tags }}
132-
matrix-rows: ${{ toJSON(steps.*.outputs.version) }}
131+
matrix_results: ${{ toJSON(steps.collect_versions.outputs.results) }}
133132
steps:
134133
- uses: actions/checkout@v3
135134
- uses: DeterminateSystems/nix-installer-action@main
@@ -150,32 +149,44 @@ jobs:
150149
}
151150
let pg_version = (open ansible/vars.yml | get postgres_release | get $release_key | str trim)
152151
153-
$"pg_version=($pg_version)" | save --append $env.GITHUB_OUTPUT
152+
$"pg_version=supabase/postgres:($pg_version)" | save --append $env.GITHUB_OUTPUT
154153
'
154+
- name: Output version
155+
id: output_version
156+
run: |
157+
echo "result=${{ steps.get_version.outputs.pg_version }}" >> $GITHUB_OUTPUT
158+
- name: Collect versions
159+
id: collect_versions
160+
run: |
161+
echo "results[${{ strategy.job-index }}]=${{ steps.output_version.outputs.result }}" >> $GITHUB_OUTPUT
155162
- name: Merge multi-arch manifests
156163
run: |
157164
docker buildx imagetools create -t supabase/postgres:${{ steps.get_version.outputs.pg_version }} \
158165
supabase/postgres:${{ steps.get_version.outputs.pg_version }}_amd64 \
159166
supabase/postgres:${{ steps.get_version.outputs.pg_version }}_arm64
160-
- name: Create step output
161-
id: step_output
162-
run: |
163-
echo "version=${{ steps.get_version.outputs.pg_version }}" >> $GITHUB_OUTPUT
164-
- name: Combine tags
165-
if: always()
166-
id: combine_tags
167-
run: |
168-
nix run nixpkgs#nushell -- -c '
169-
let versions = (${{ toJSON(steps.*.outputs.version) }})
170-
let matrix = {
171-
include: ($versions | each { |v| {version: $v} })
172-
}
173-
$"tags=($matrix | to json -r)" | save --append $env.GITHUB_OUTPUT
174-
'
175-
publish:
167+
168+
combine_versions:
176169
needs: merge_manifest
170+
runs-on: ubuntu-latest
171+
outputs:
172+
matrix: ${{ steps.set-matrix.outputs.matrix }}
173+
steps:
174+
- uses: DeterminateSystems/nix-installer-action@main
175+
- name: Combine versions into matrix
176+
id: set-matrix
177+
run: |
178+
nix run nixpkgs#nushell -- -c '
179+
let versions = (${{ needs.merge_manifest.outputs.matrix_results }} | from json)
180+
let matrix = {
181+
include: ($versions | each { |ver| { version: $ver } })
182+
}
183+
$"matrix=($matrix | to json -r)" | save --append $env.GITHUB_OUTPUT
184+
'
185+
186+
publish:
187+
needs: combine_versions
177188
strategy:
178-
matrix: ${{ fromJson(needs.merge_manifest.outputs.tags) }}
189+
matrix: ${{ fromJson(needs.combine_versions.outputs.matrix) }}
179190
uses: ./.github/workflows/mirror.yml
180191
with:
181192
version: ${{ matrix.version }}

0 commit comments

Comments
 (0)