@@ -58,17 +58,14 @@ jobs:
5858 token : ${{ secrets.YDBOT_TOKEN }}
5959 ref : ${{ inputs.commit_sha }}
6060 fetch-depth : 0
61-
6261 - name : Configure git
6362 uses : ./.github/actions/configure_git
64-
6563 - name : Read current version
6664 id : read-version
6765 run : |
6866 CURRENT_VERSION=$(cat ydb/apps/ydb/version.txt)
6967 echo "current-version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
7068 echo "Current version: $CURRENT_VERSION"
71-
7269 - name : Calculate new version
7370 id : update-version
7471 run : |
7774 MAJOR=${VERSION_PARTS[0]}
7875 MINOR=${VERSION_PARTS[1]}
7976 PATCH=${VERSION_PARTS[2]}
80-
8177 if [ "${{ inputs.version-change }}" = "MAJOR" ]; then
8278 MAJOR=$((MAJOR+1))
8379 MINOR=0
@@ -88,74 +84,61 @@ jobs:
8884 elif [ "${{ inputs.version-change }}" = "PATCH" ]; then
8985 PATCH=$((PATCH+1))
9086 fi
91-
9287 NEW_VERSION="$MAJOR.$MINOR.$PATCH"
9388 echo "new-version=$NEW_VERSION" >> $GITHUB_OUTPUT
9489 echo "New version: $NEW_VERSION"
95-
9690 - name : Create release branch
9791 id : create-branch
9892 run : |
9993 # Ensure we're on main before creating release branch
10094 git fetch origin main
10195 git checkout main
10296 git reset --hard origin/main
103-
10497 BRANCH_NAME="cli-release/${{ steps.update-version.outputs.new-version }}"
10598 git checkout -b "$BRANCH_NAME"
10699 echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
107100 echo "Created branch: $BRANCH_NAME"
108-
109101 - name : Check CHANGELOG.md format
110102 run : |
111103 # Check if the file starts with empty line - version - empty line pattern
112104 HEAD_LINES=$(head -n 3 ydb/apps/ydb/CHANGELOG.md)
113105 FIRST_LINE=$(head -n 1 ydb/apps/ydb/CHANGELOG.md)
114106 SECOND_LINE=$(head -n 2 ydb/apps/ydb/CHANGELOG.md | tail -n 1)
115107 THIRD_LINE=$(head -n 3 ydb/apps/ydb/CHANGELOG.md | tail -n 1)
116-
117108 if [[ -z "$FIRST_LINE" ]] && [[ "$SECOND_LINE" =~ ^##.*##$ ]] && [[ -z "$THIRD_LINE" ]]; then
118109 echo "Error: CHANGELOG has nothing new since last release"
119110 exit 1
120111 fi
121-
122112 - name : Update version file
123113 run : |
124114 echo "${{ steps.update-version.outputs.new-version }}" > ydb/apps/ydb/version.txt
125115 git add ydb/apps/ydb/version.txt
126-
127116 - name : Update CHANGELOG
128117 run : |
129118 NEW_VERSION="${{ steps.update-version.outputs.new-version }}"
130119 # Create temporary file with new changelog structure
131120 echo "" > /tmp/changelog_header.md
132121 echo "## $NEW_VERSION ##" >> /tmp/changelog_header.md
133122 echo "" >> /tmp/changelog_header.md
134-
135123 # Combine new header with existing changelog
136124 cat /tmp/changelog_header.md ydb/apps/ydb/CHANGELOG.md > /tmp/new_changelog.md
137125 mv /tmp/new_changelog.md ydb/apps/ydb/CHANGELOG.md
138-
139126 git add ydb/apps/ydb/CHANGELOG.md
140-
141127 - name : Create CLI version file
142128 run : |
143129 NEW_VERSION="${{ steps.update-version.outputs.new-version }}"
144130 echo "$NEW_VERSION" > cli_version.txt
145131 echo "Created cli_version.txt with version: $NEW_VERSION"
146-
147132 - name : Upload CLI version artifact
148133 uses : actions/upload-artifact@v4
149134 with :
150135 name : cli-version
151136 path : cli_version.txt
152137 if-no-files-found : error
153138 retention-days : 1
154-
155139 - name : Commit changes
156140 run : |
157141 git commit -m "YDB CLI release ${{ steps.update-version.outputs.new-version }}"
158-
159142 - name : Push branch
160143 run : |
161144 git push origin "${{ steps.create-branch.outputs.branch-name }}"
@@ -191,7 +174,6 @@ jobs:
191174 MATRIX=$(echo $MATRIX | jq -c '.include += [{"os": "windows-amd", "runner": "windows-latest", "shell": "bash", "binary": "ydb.exe", "platform": "DEFAULT-WIN-X86_64"}]')
192175 echo "Matrix after adding windows-amd: $MATRIX"
193176 fi
194-
195177 echo "Final output matrix: $MATRIX"
196178 echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"
197179 MATRIX=$(echo $MATRIX | jq '.')
@@ -212,12 +194,10 @@ jobs:
212194 uses : actions/checkout@v4
213195 with :
214196 ref : ${{ needs.prepare-release.outputs.branch-name }}
215-
216197 - name : Print debug information
217198 run : |
218199 uname -a
219200 echo "YDB CLI version: $(cat ydb/apps/ydb/version.txt) (read from ydb/apps/ydb/version.txt)"
220-
221201 # Turns out it is crucial to prepare VS environment and build in one step due to env variable visibility
222202 - name : Prepare Visual Studio environment and build windows binary with ya make
223203 if : ${{ matrix.os == 'windows-amd' }}
@@ -234,7 +214,6 @@ jobs:
234214 - name : Build unix binary with ya make
235215 if : ${{ matrix.os != 'windows-amd' }}
236216 run : ./ya make ydb/apps/ydb -r -DUSE_SSE4=no --target-platform ${{ matrix.platform }}
237-
238217 - name : Upload binary to artifact
239218 uses : actions/upload-artifact@v4
240219 with :
@@ -254,7 +233,6 @@ jobs:
254233 ref : ${{ needs.prepare-release.outputs.branch-name }}
255234 - name : Print YDB CLI version ${{ needs.prepare-release.outputs.new-version }}
256235 run : echo ${{ needs.prepare-release.outputs.new-version }}
257-
258236 - name : Prepare directory for linux-amd binary
259237 if : ${{ inputs.build-linux-amd }}
260238 run : mkdir -p ${{ needs.prepare-release.outputs.new-version }}/linux/amd64
@@ -270,7 +248,6 @@ jobs:
270248 - name : Prepare directory for windows-amd binary
271249 if : ${{ inputs.build-windows-amd }}
272250 run : mkdir -p ${{ needs.prepare-release.outputs.new-version }}/windows/amd64/unsigned
273-
274251 - name : Copy linux-amd binary
275252 if : ${{ inputs.build-linux-amd }}
276253 uses : actions/download-artifact@v4
@@ -301,10 +278,8 @@ jobs:
301278 with :
302279 name : windows-amd-binary
303280 path : ${{ needs.prepare-release.outputs.new-version }}/windows/amd64/unsigned/
304-
305281 - name : Print resulting file hierarchy
306282 run : find ${{ needs.prepare-release.outputs.new-version }} | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/"
307-
308283 - name : Download s3
309284 run : wget https://github.com/s3tools/s3cmd/releases/download/v2.4.0/s3cmd-2.4.0.tar.gz
310285 - name : Unzip s3
@@ -314,7 +289,6 @@ jobs:
314289 cd s3cmd-2.4.0
315290 sudo python3 setup.py install
316291 cd ..
317-
318292 - name : Upload to S3
319293 env :
320294 S3_HOST : " storage.yandexcloud.net"
@@ -334,10 +308,8 @@ jobs:
334308 with :
335309 token : ${{ secrets.YDBOT_TOKEN }}
336310 fetch-depth : 0
337-
338311 - name : Configure git
339312 uses : ./.github/actions/configure_git
340-
341313 - name : Create and auto-merge PR
342314 id : create-pr
343315 env :
@@ -354,41 +326,46 @@ jobs:
354326 '' \
355327 '### Description for reviewers' \
356328 "Automated release PR for CLI version ${{ needs.prepare-release.outputs.new-version }}"
357-
358329 PR_URL=$(gh pr create \
359330 --title "$PR_TITLE" \
360331 --body "$PR_BODY" \
361332 --head "${{ needs.prepare-release.outputs.branch-name }}" \
362333 --base main \
363334 --repo ${{ github.repository }})
364-
365335 # Extract PR number from URL (e.g., "https://github.com/user/repo/pull/12" -> "12")
366336 PR_NUMBER=$(basename "$PR_URL")
367-
368337 echo "Created PR #$PR_NUMBER"
369338 echo "PR URL: $PR_URL"
370339 echo "pr-number=$PR_NUMBER" >> $GITHUB_OUTPUT
371-
340+ echo "pr-url=$PR_URL" >> $GITHUB_OUTPUT
372341 if gh pr merge "$PR_NUMBER" --merge --auto; then
373342 echo "Auto-merge enabled for PR #$PR_NUMBER"
374343 else
375344 echo "Auto-merge failed - branch protection rules required"
376345 echo "Please merge PR manually: $PR_URL"
377346 exit 1
378347 fi
379-
348+ - name : Create PR URL file
349+ run : |
350+ echo "${{ steps.create-pr.outputs.pr-url }}" > pr_url.txt
351+ echo "Created pr_url.txt with PR URL: ${{ steps.create-pr.outputs.pr-url }}"
352+ - name : Upload PR URL artifact
353+ uses : actions/upload-artifact@v4
354+ with :
355+ name : pr-url
356+ path : pr_url.txt
357+ if-no-files-found : error
358+ retention-days : 1
380359 - name : Wait for PR merge
381360 env :
382361 GH_TOKEN : ${{ secrets.YDBOT_TOKEN }}
383362 run : |
384363 PR_NUMBER="${{ steps.create-pr.outputs.pr-number }}"
385364 echo "Waiting for PR #$PR_NUMBER to be merged (tests may take 30-60+ minutes)..."
386-
387365 # Wait up to 4 hours, checking every 5 minutes
388366 for i in {1..48}; do # 48 * 5 minutes = 4 hours
389367 # Check if PR is merged via GitHub API
390368 PR_STATE=$(gh pr view "$PR_NUMBER" --json state,mergedAt --jq '.state + ":" + (.mergedAt != null | tostring)')
391-
392369 if [[ "$PR_STATE" == "MERGED:true" ]]; then
393370 echo "PR merged successfully"
394371 break
@@ -399,13 +376,11 @@ jobs:
399376 echo "PR still pending (attempt $i/24), state: $PR_STATE, waiting 5 minutes..."
400377 sleep 300 # 5 minutes
401378 fi
402-
403379 # Log progress every 30 minutes
404380 if [ $((i % 6)) -eq 0 ]; then
405381 echo "Still waiting after $((i * 5)) minutes..."
406382 fi
407383 done
408-
409384 # Check if we timed out
410385 PR_STATE=$(gh pr view "$PR_NUMBER" --json state,mergedAt --jq '.state + ":" + (.mergedAt != null | tostring)')
411386 if [[ "$PR_STATE" != "MERGED:true" ]]; then
@@ -414,7 +389,6 @@ jobs:
414389 echo "PR URL: $(gh pr view "$PR_NUMBER" --json url --jq '.url')"
415390 exit 1
416391 fi
417-
418392 - name : Create release tag
419393 run : |
420394 # Create tag on release branch (exact state that CLI was built in)
@@ -424,7 +398,6 @@ jobs:
424398 git push origin "CLI_${{ needs.prepare-release.outputs.new-version }}"
425399 echo "Created and pushed tag CLI_${{ needs.prepare-release.outputs.new-version }} on release branch"
426400
427-
428401 cleanup-on-failure :
429402 name : Cleanup release branch on failure
430403 needs : [prepare-release, gather-and-push-to-s3]
@@ -436,10 +409,8 @@ jobs:
436409 with :
437410 token : ${{ secrets.YDBOT_TOKEN }}
438411 fetch-depth : 0
439-
440412 - name : Configure git
441413 uses : ./.github/actions/configure_git
442-
443414 - name : Delete release branch
444415 run : |
445416 # Delete the branch
0 commit comments