Skip to content

Commit f65c5e6

Browse files
committed
chore: back to this version
1 parent baa41b0 commit f65c5e6

File tree

1 file changed

+23
-66
lines changed

1 file changed

+23
-66
lines changed

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

Lines changed: 23 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ jobs:
5454
5555
# Output the matrix configuration
5656
echo "matrix_config=$MATRIX_CONFIG" >> $GITHUB_OUTPUT
57-
5857
build:
5958
needs: prepare
6059
strategy:
@@ -78,7 +77,6 @@ jobs:
7877
PG_VERSION=$(echo $PG_VERSION | tr -d '"') # Remove any surrounding quotes
7978
echo 'postgres-version = "'$PG_VERSION'"' > common-nix.vars.pkr.hcl
8079
echo "" >> common-nix.vars.pkr.hcl
81-
8280
- id: settings
8381
run: sed -r 's/(\s|\")+//g' common-nix.vars.pkr.hcl >> $GITHUB_OUTPUT
8482

@@ -93,77 +91,46 @@ jobs:
9391
mkdir -p ./versions
9492
echo "${{ matrix.version }}" > ./versions/version.txt
9593
echo "supabase/postgres:${{ steps.settings.outputs.postgres-version }}" > ./versions/tag.txt
96-
9794
- uses: actions/upload-artifact@v3
9895
with:
9996
name: version-info-${{ matrix.version }}
10097
path: ./versions/
10198

102-
- id: combine-outputs
99+
# Only run in first matrix job to combine all outputs
100+
- if: matrix.version == fromJson(needs.prepare.outputs.matrix_config).include[0].version
101+
id: combine-outputs
103102
run: |
104103
# Wait for other matrix jobs to complete by sleeping briefly
105104
sleep 15
106-
107-
# First verify if this is the controlling job
108-
matrix_json='${{ needs.prepare.outputs.matrix_config }}'
109-
first_version=$(echo "$matrix_json" | grep -o '"version":"[^"]*"' | sed 's/.*:"//;s/"//' | head -1)
110-
current_version="${{ matrix.version }}"
111-
112-
# Only proceed if this is the controlling job (matches first version)
113-
if [ "$current_version" != "$first_version" ]; then
114-
echo "This is not the controlling job. Skipping."
115-
exit 0
116-
fi
117-
105+
# Create arrays to hold all versions and tags
118106
versions_array="["
119107
tags_array="["
120108
first=true
121-
122-
# Extract versions using grep and sed
123-
versions=$(echo "$matrix_json" | grep -o '"version":"[^"]*"' | sed 's/.*:"//;s/"//')
124-
125-
# For each version
126-
while read -r version; do
127-
# Skip empty versions
128-
if [ -z "$version" ]; then
129-
continue
130-
fi
131-
109+
# For each version in the matrix config
110+
for row in $(echo '${{ needs.prepare.outputs.matrix_config }}' | jq -c '.include[]'); do
111+
version=$(echo $row | jq -r '.version')
112+
132113
if [ "$first" = true ]; then
133114
first=false
134115
else
135116
versions_array+=","
136117
tags_array+=","
137118
fi
138-
139-
# Get version differently based on version type
140-
if [[ "$version" == *"orioledb-"* ]]; then
141-
PG_VERSION=$(nix run nixpkgs#yq -- '.postgres_release.postgresorioledb-17' ansible/vars.yml)
142-
else
143-
PG_VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'$version'"]' ansible/vars.yml)
144-
fi
145119
146-
# Ensure PG_VERSION is not empty and remove quotes
147-
if [ -n "$PG_VERSION" ]; then
148-
PG_VERSION=$(echo $PG_VERSION | tr -d '"')
149-
150-
versions_array+="\"${version}\""
151-
tags_array+="\"supabase/postgres:${PG_VERSION}\""
152-
fi
153-
done <<< "$versions"
154-
120+
# Download and read artifacts
121+
mkdir -p ./download
122+
echo "Processing version $version"
123+
124+
tag=$(cat ./versions/tag.txt)
125+
126+
versions_array+="\"$version\""
127+
tags_array+="\"$tag\""
128+
done
155129
versions_array+="]"
156130
tags_array+="]"
157-
158-
# Validate arrays are not empty
159-
if [ "$versions_array" = "[]" ] || [ "$tags_array" = "[]" ]; then
160-
echo "Error: No valid versions found"
161-
exit 1
162-
fi
163-
131+
# Set outputs
164132
echo "versions=$versions_array" >> $GITHUB_OUTPUT
165133
echo "image_tags=$tags_array" >> $GITHUB_OUTPUT
166-
167134
build_release_image:
168135
needs: build
169136
strategy:
@@ -229,7 +196,7 @@ jobs:
229196
SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK }}
230197
SLACK_USERNAME: "gha-failures-notifier"
231198
SLACK_COLOR: "danger"
232-
SLACK_MESSAGE: "Building Postgres image failed for version ${{ matrix.image_tag }}"
199+
SLACK_MESSAGE: "Building Postgres image failed for version ${{ matrix.version }}"
233200
SLACK_FOOTER: ""
234201

235202
get_publish_version:
@@ -239,24 +206,14 @@ jobs:
239206
image_tag: ${{ fromJson(needs.build.outputs.image_tags) }}
240207
runs-on: ubuntu-latest
241208
outputs:
242-
version: ${{ steps.get_version.outputs.version }}
209+
version: ${{ steps.get_version.outputs.version }}
243210
steps:
244-
- uses: actions/checkout@v3
245-
246-
- uses: DeterminateSystems/nix-installer-action@main
247-
248211
- id: get_version
249212
run: |
250-
# Get the full version from vars.yml for orioledb
251-
if [[ "${{ matrix.image_tag }}" == *"orioledb"* ]]; then
252-
VERSION=$(nix run nixpkgs#yq -- '.postgres_release.postgresorioledb-17' ansible/vars.yml)
253-
VERSION=$(echo $VERSION | tr -d '"') # Remove quotes
254-
else
255-
# For regular postgres, get version from the image tag
256-
VERSION=$(echo "${{ matrix.image_tag }}" | sed 's|supabase/postgres:||')
257-
fi
213+
VERSION=$(echo "${{ matrix.image_tag }}" | sed 's|supabase/postgres:||')
214+
# Changed to match the output name expected by the publish job
215+
echo "Extracted version: $VERSION"
258216
echo "version=$VERSION" >> $GITHUB_OUTPUT
259-
260217
publish:
261218
needs: get_publish_version
262219
uses: ./.github/workflows/mirror.yml

0 commit comments

Comments
 (0)