@@ -50,20 +50,20 @@ jobs:
50
50
echo "::error::Required Dockerfiles not found!"
51
51
exit 1
52
52
fi
53
-
53
+
54
54
CURRENT_INNOVATION=$(grep -oP '(?<=^ARG MYSQL_SHELL_VERSION=)\d+\.\d+\.\d+' docker/innovation/Dockerfile)
55
55
CURRENT_LTS=$(grep -oP '(?<=^ARG MYSQL_SHELL_VERSION=)\d+\.\d+\.\d+' docker/lts/Dockerfile)
56
-
56
+
57
57
if [[ -z "$CURRENT_INNOVATION" ]] || [[ -z "$CURRENT_LTS" ]]; then
58
58
echo "::error::Failed to extract current versions from Dockerfiles"
59
59
exit 1
60
60
fi
61
-
61
+
62
62
echo "CURRENT_INNOVATION=${CURRENT_INNOVATION}" >> $GITHUB_OUTPUT
63
63
echo "CURRENT_LTS=${CURRENT_LTS}" >> $GITHUB_OUTPUT
64
64
echo "Current Innovation: $CURRENT_INNOVATION"
65
65
echo "Current LTS: $CURRENT_LTS"
66
-
66
+
67
67
# Extract major versions (for later use)
68
68
INNOVATION_MAJOR_VERSION=$(echo "$CURRENT_INNOVATION" | cut -d. -f1)
69
69
LTS_MAJOR_VERSION=$(echo "$CURRENT_LTS" | cut -d. -f1)
76
76
# Get tag information from GitHub API
77
77
INNOVATION_MAJOR="${{ steps.current_versions.outputs.INNOVATION_MAJOR_VERSION }}"
78
78
LTS_MAJOR="${{ steps.current_versions.outputs.LTS_MAJOR_VERSION }}"
79
-
79
+
80
80
# Use manually specified version for testing if provided
81
81
if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ github.event.inputs.innovation_version }}" ]]; then
82
82
LATEST_INNOVATION="${{ github.event.inputs.innovation_version }}"
@@ -87,15 +87,15 @@ jobs:
87
87
-H "X-GitHub-Api-Version: 2022-11-28" \
88
88
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
89
89
"https://api.github.com/repos/mysql/mysql-shell/tags?per_page=100")
90
-
90
+
91
91
if [[ -z "$API_RESPONSE" ]] || [[ "$API_RESPONSE" == *"rate limit"* ]] || [[ "$API_RESPONSE" == *"Bad credentials"* ]]; then
92
92
echo "::error::Failed to fetch data from GitHub API: $(echo "$API_RESPONSE" | grep -o '"message":"[^"]*"' || echo 'Unknown error')"
93
93
exit 1
94
94
fi
95
-
95
+
96
96
# Dynamically build regex pattern
97
97
INNOVATION_PATTERN="^${INNOVATION_MAJOR}\\.\\d+\\.\\d+$"
98
-
98
+
99
99
LATEST_INNOVATION=$(echo "$API_RESPONSE" | jq -r --arg pattern "$INNOVATION_PATTERN" '[.[] | select(.name | test($pattern))][0].name')
100
100
fi
101
101
@@ -108,15 +108,15 @@ jobs:
108
108
LTS_PATTERN="^${LTS_MAJOR}\\.\\d+\\.\\d+$"
109
109
LATEST_LTS=$(echo "$API_RESPONSE" | jq -r --arg pattern "$LTS_PATTERN" '[.[] | select(.name | test($pattern))][0].name')
110
110
fi
111
-
111
+
112
112
# Validate results
113
113
if [[ -z "$LATEST_INNOVATION" ]] || [[ "$LATEST_INNOVATION" == "null" ]] || [[ -z "$LATEST_LTS" ]] || [[ "$LATEST_LTS" == "null" ]]; then
114
114
echo "::warning::Failed to find matching versions. Using hardcoded patterns as fallback."
115
115
# Fallback: hardcoded version patterns
116
116
LATEST_INNOVATION=${LATEST_INNOVATION:-$(echo "$API_RESPONSE" | jq -r '[.[] | select(.name | test("^9\\.\\d+\\.\\d+$"))][0].name')}
117
117
LATEST_LTS=${LATEST_LTS:-$(echo "$API_RESPONSE" | jq -r '[.[] | select(.name | test("^8\\.\\d+\\.\\d+$"))][0].name')}
118
118
fi
119
-
119
+
120
120
echo "LATEST_INNOVATION=${LATEST_INNOVATION}" >> $GITHUB_OUTPUT
121
121
echo "LATEST_LTS=${LATEST_LTS}" >> $GITHUB_OUTPUT
122
122
echo "Latest Innovation: $LATEST_INNOVATION"
@@ -130,15 +130,15 @@ jobs:
130
130
# Returns 0 if $1 > $2
131
131
test "$(echo "$1 $2" | tr " " "\n" | sort -V | head -n 1)" != "$1"
132
132
}
133
-
133
+
134
134
CURRENT_INNOVATION="${{ steps.current_versions.outputs.CURRENT_INNOVATION }}"
135
135
LATEST_INNOVATION="${{ steps.latest_tags.outputs.LATEST_INNOVATION }}"
136
136
CURRENT_LTS="${{ steps.current_versions.outputs.CURRENT_LTS }}"
137
137
LATEST_LTS="${{ steps.latest_tags.outputs.LATEST_LTS }}"
138
-
138
+
139
139
INNOVATION_UPDATE_NEEDED="false"
140
140
LTS_UPDATE_NEEDED="false"
141
-
141
+
142
142
# Check Innovation version
143
143
if [[ -z "$LATEST_INNOVATION" ]] || [[ "$LATEST_INNOVATION" == "null" ]]; then
144
144
echo "::warning::No valid Innovation version found in API response"
@@ -152,7 +152,7 @@ jobs:
152
152
else
153
153
echo "Innovation is up-to-date at version $CURRENT_INNOVATION."
154
154
fi
155
-
155
+
156
156
# Check LTS version
157
157
if [[ -z "$LATEST_LTS" ]] || [[ "$LATEST_LTS" == "null" ]]; then
158
158
echo "::warning::No valid LTS version found in API response"
@@ -166,7 +166,7 @@ jobs:
166
166
else
167
167
echo "LTS is up-to-date at version $CURRENT_LTS."
168
168
fi
169
-
169
+
170
170
# In test mode, always report updates are needed
171
171
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.dry_run }}" == "true" ]]; then
172
172
if [[ -n "${{ github.event.inputs.innovation_version }}" ]]; then
@@ -178,7 +178,7 @@ jobs:
178
178
LTS_UPDATE_NEEDED="true"
179
179
fi
180
180
fi
181
-
181
+
182
182
echo "INNOVATION_UPDATE_NEEDED=${INNOVATION_UPDATE_NEEDED}" >> $GITHUB_OUTPUT
183
183
echo "LTS_UPDATE_NEEDED=${LTS_UPDATE_NEEDED}" >> $GITHUB_OUTPUT
184
184
@@ -210,19 +210,19 @@ jobs:
210
210
BRANCH_NAME="bot/update-mysql-shell-$(date +%Y%m%d%H%M%S)"
211
211
fi
212
212
echo "Using branch name: $BRANCH_NAME"
213
-
213
+
214
214
# Export as environment variable for scripts that need it
215
215
export BRANCH_NAME
216
-
216
+
217
217
# Set as output for reuse in subsequent steps
218
218
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT
219
-
219
+
220
220
# Verify that update script exists before execution
221
221
if [ ! -f .github/check-new-release/scripts/update.sh ]; then
222
222
echo "::error::Script .github/check-new-release/scripts/update.sh not found"
223
223
exit 1
224
224
fi
225
-
225
+
226
226
# Check if the script has execution permissions and capture exit status immediately
227
227
if [ -x .github/check-new-release/scripts/update.sh ]; then
228
228
# If executable, run directly
@@ -238,7 +238,7 @@ jobs:
238
238
# Immediately capture exit status to avoid overwrites
239
239
UPDATE_STATUS=$?
240
240
fi
241
-
241
+
242
242
# Check exit status
243
243
if [ $UPDATE_STATUS -ne 0 ]; then
244
244
echo "::error::Script update.sh exited with status $UPDATE_STATUS"
@@ -260,7 +260,7 @@ jobs:
260
260
if [ -z "$BRANCH_NAME" ]; then
261
261
echo "::warning::Branch name not available from previous step"
262
262
echo "Generating fallback branch name based on version information"
263
-
263
+
264
264
# Generate branch name using version information even in fallback
265
265
if [[ "$INNOVATION_UPDATE_NEEDED" == "true" && "$LTS_UPDATE_NEEDED" == "true" ]]; then
266
266
# Both versions need updating
@@ -275,21 +275,21 @@ jobs:
275
275
# Ultimate fallback with timestamp
276
276
BRANCH_NAME="bot/update-mysql-shell-fallback-$(date +%Y%m%d%H%M%S)"
277
277
fi
278
-
278
+
279
279
echo "Generated fallback branch name: $BRANCH_NAME"
280
280
else
281
281
echo "Using branch name from previous step: $BRANCH_NAME"
282
282
fi
283
-
283
+
284
284
# Export as environment variable for scripts that need it
285
285
export BRANCH_NAME
286
-
286
+
287
287
# Verify that post-message script exists before execution
288
288
if [ ! -f .github/check-new-release/scripts/post-message.sh ]; then
289
289
echo "::error::Script post-message.sh not found"
290
290
exit 1
291
291
fi
292
-
292
+
293
293
# Check if the script has execution permissions and capture exit status immediately
294
294
if [ -x .github/check-new-release/scripts/post-message.sh ]; then
295
295
# If executable, run directly
@@ -305,7 +305,7 @@ jobs:
305
305
# Immediately capture exit status to avoid overwrites
306
306
POST_MESSAGE_STATUS=$?
307
307
fi
308
-
308
+
309
309
# Check exit status
310
310
if [ $POST_MESSAGE_STATUS -ne 0 ]; then
311
311
echo "::error::Script post-message.sh exited with status $POST_MESSAGE_STATUS"
0 commit comments