54
54
55
55
# Output the matrix configuration
56
56
echo "matrix_config=$MATRIX_CONFIG" >> $GITHUB_OUTPUT
57
-
58
57
build :
59
58
needs : prepare
60
59
strategy :
78
77
PG_VERSION=$(echo $PG_VERSION | tr -d '"') # Remove any surrounding quotes
79
78
echo 'postgres-version = "'$PG_VERSION'"' > common-nix.vars.pkr.hcl
80
79
echo "" >> common-nix.vars.pkr.hcl
81
-
82
80
- id : settings
83
81
run : sed -r 's/(\s|\")+//g' common-nix.vars.pkr.hcl >> $GITHUB_OUTPUT
84
82
@@ -93,77 +91,46 @@ jobs:
93
91
mkdir -p ./versions
94
92
echo "${{ matrix.version }}" > ./versions/version.txt
95
93
echo "supabase/postgres:${{ steps.settings.outputs.postgres-version }}" > ./versions/tag.txt
96
-
97
94
- uses : actions/upload-artifact@v3
98
95
with :
99
96
name : version-info-${{ matrix.version }}
100
97
path : ./versions/
101
98
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
103
102
run : |
104
103
# Wait for other matrix jobs to complete by sleeping briefly
105
104
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
118
106
versions_array="["
119
107
tags_array="["
120
108
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
+
132
113
if [ "$first" = true ]; then
133
114
first=false
134
115
else
135
116
versions_array+=","
136
117
tags_array+=","
137
118
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
145
119
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
155
129
versions_array+="]"
156
130
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
164
132
echo "versions=$versions_array" >> $GITHUB_OUTPUT
165
133
echo "image_tags=$tags_array" >> $GITHUB_OUTPUT
166
-
167
134
build_release_image :
168
135
needs : build
169
136
strategy :
@@ -229,7 +196,7 @@ jobs:
229
196
SLACK_WEBHOOK : ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK }}
230
197
SLACK_USERNAME : " gha-failures-notifier"
231
198
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 }}"
233
200
SLACK_FOOTER : " "
234
201
235
202
get_publish_version :
@@ -239,24 +206,14 @@ jobs:
239
206
image_tag : ${{ fromJson(needs.build.outputs.image_tags) }}
240
207
runs-on : ubuntu-latest
241
208
outputs :
242
- version : ${{ steps.get_version.outputs.version }}
209
+ version : ${{ steps.get_version.outputs.version }}
243
210
steps :
244
- - uses : actions/checkout@v3
245
-
246
- - uses : DeterminateSystems/nix-installer-action@main
247
-
248
211
- id : get_version
249
212
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"
258
216
echo "version=$VERSION" >> $GITHUB_OUTPUT
259
-
260
217
publish :
261
218
needs : get_publish_version
262
219
uses : ./.github/workflows/mirror.yml
0 commit comments