Skip to content

Commit 6731dab

Browse files
committed
feat: collect all versions into file, then array
1 parent e5cbc7c commit 6731dab

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ jobs:
6161
matrix: ${{ fromJson(needs.prepare.outputs.matrix_config) }}
6262
runs-on: ubuntu-latest
6363
outputs:
64-
versions: ${{ steps.versions.outputs.list }}
65-
image_tags: ${{ steps.versions.outputs.image_tags }}
64+
versions: ${{ steps.collect-versions.outputs.versions }}
65+
image_tags: ${{ steps.collect-versions.outputs.image_tags }}
6666
steps:
6767
- uses: actions/checkout@v3
6868

@@ -86,10 +86,25 @@ jobs:
8686
with:
8787
cmd: yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' 'ansible/vars.yml'
8888

89-
- id: versions
89+
# First collect all versions into a file
90+
- name: Save version info
9091
run: |
91-
echo "list=[\"${{ matrix.version }}\"]" >> $GITHUB_OUTPUT
92-
echo "image_tags=[\"supabase/postgres:${{ steps.settings.outputs.postgres-version }}\"]" >> $GITHUB_OUTPUT
92+
mkdir -p /tmp/versions
93+
echo "${{ matrix.version }}" >> /tmp/versions/versions.txt
94+
echo "supabase/postgres:${{ steps.settings.outputs.postgres-version }}" >> /tmp/versions/image_tags.txt
95+
96+
# Then at the end of the matrix, collect all versions into arrays
97+
- name: Collect all versions
98+
id: collect-versions
99+
if: ${{ always() }}
100+
run: |
101+
# Combine all versions into arrays
102+
VERSIONS=$(cat /tmp/versions/versions.txt | sort -u | jq -R . | jq -s .)
103+
IMAGE_TAGS=$(cat /tmp/versions/image_tags.txt | sort -u | jq -R . | jq -s .)
104+
105+
# Output as JSON arrays
106+
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
107+
echo "image_tags=$IMAGE_TAGS" >> $GITHUB_OUTPUT
93108
94109
build_release_image:
95110
needs: build

0 commit comments

Comments
 (0)