3939 required : true
4040 type : string
4141 release_branch :
42- description : ' Release branch (e.g., release/2.3)'
42+ description : ' Release branch (e.g., release/2.3._ )'
4343 required : true
4444 type : string
4545 next_snapshot :
@@ -59,6 +59,7 @@ defaults:
5959env :
6060 RELEASE_VERSION : ${{ inputs.release_version }}
6161 RELEASE_TAG : v${{ inputs.release_version }}
62+ RC_TAG : v${{ inputs.release_version }}_RC
6263
6364jobs :
6465 # ============================================================
@@ -117,6 +118,15 @@ jobs:
117118 echo "::error::Tag v${{ inputs.release_version }} already exists on remote"
118119 exit 1
119120 fi
121+ # Check for leftover RC tag
122+ if git rev-parse "${RC_TAG}" >/dev/null 2>&1; then
123+ echo "::error::RC tag ${RC_TAG} already exists locally. Clean up with: git tag -d ${RC_TAG}"
124+ exit 1
125+ fi
126+ if git ls-remote --tags origin "refs/tags/${RC_TAG}" | grep -q .; then
127+ echo "::error::RC tag ${RC_TAG} already exists on remote. Clean up with: git push origin :refs/tags/${RC_TAG}"
128+ exit 1
129+ fi
120130 echo "Tag does not exist - OK"
121131
122132 - name : Check if release branch exists
@@ -338,26 +348,26 @@ jobs:
338348 echo "sha=${SHA}" >> $GITHUB_OUTPUT
339349 echo "Release commit: ${SHA}"
340350
341- - name : Create tag
351+ - name : Create RC tag
342352 if : ${{ inputs.dry_run != true }}
343353 run : |
344- git tag -a "${RELEASE_TAG }" -m "Release ${RELEASE_TAG}"
345- echo "Created tag ${RELEASE_TAG }"
354+ git tag -a "${RC_TAG }" -m "Release candidate ${RELEASE_TAG}"
355+ echo "Created RC tag ${RC_TAG }"
346356
347- - name : Push branch and tag
357+ - name : Push branch and RC tag
348358 if : ${{ inputs.dry_run != true }}
349359 run : |
350360 git push origin "${{ inputs.release_branch }}"
351- git push origin "${RELEASE_TAG }"
352- echo "Pushed branch and tag"
361+ git push origin "${RC_TAG }"
362+ echo "Pushed branch and RC tag"
353363
354364 - name : Dry run summary
355365 if : ${{ inputs.dry_run == true }}
356366 run : |
357367 echo "::warning::DRY RUN - Branch and tag NOT pushed"
358368 echo "Would have pushed:"
359369 echo " - Branch: ${{ inputs.release_branch }}"
360- echo " - Tag: ${RELEASE_TAG }"
370+ echo " - RC Tag: ${RC_TAG }"
361371
362372 # ============================================================
363373 # Job 5: Stage to Maven Central (does NOT release)
@@ -368,10 +378,10 @@ jobs:
368378 runs-on : ubuntu-latest
369379 if : ${{ inputs.dry_run != true }}
370380 steps :
371- - name : Checkout release tag
381+ - name : Checkout RC tag
372382 uses : actions/checkout@v6
373383 with :
374- ref : ${{ env.RELEASE_TAG }}
384+ ref : ${{ env.RC_TAG }}
375385
376386 - name : Cache Java binaries
377387 id : cache-java
@@ -547,6 +557,46 @@ jobs:
547557 git push || echo "⚠️ Push failed - update catalog manually at https://github.com/btraceio/jbang-catalog"
548558 fi
549559
560+ # ============================================================
561+ # Job 5d: Finalize release tag (RC -> final)
562+ # ============================================================
563+ finalize-tag :
564+ name : Finalize Release Tag
565+ needs : [prepare-release, wait-for-maven]
566+ runs-on : ubuntu-latest
567+ if : ${{ inputs.dry_run != true }}
568+ steps :
569+ - name : Checkout at release SHA
570+ uses : actions/checkout@v6
571+ with :
572+ ref : ${{ needs.prepare-release.outputs.release_sha }}
573+ fetch-depth : 0
574+ token : ${{ secrets.GITHUB_TOKEN }}
575+
576+ - name : Fetch tags
577+ run : git fetch origin --tags
578+
579+ - name : Configure Git
580+ run : |
581+ git config user.name "github-actions[bot]"
582+ git config user.email "github-actions[bot]@users.noreply.github.com"
583+
584+ - name : Create final tag
585+ run : |
586+ git tag -a "${RELEASE_TAG}" -m "Release ${RELEASE_TAG}"
587+ echo "Created final tag ${RELEASE_TAG}"
588+
589+ - name : Push final tag
590+ run : |
591+ git push origin "${RELEASE_TAG}"
592+ echo "Pushed final tag ${RELEASE_TAG}"
593+
594+ - name : Delete RC tag
595+ run : |
596+ git tag -d "${RC_TAG}" || true
597+ git push origin ":refs/tags/${RC_TAG}" || true
598+ echo "Deleted RC tag ${RC_TAG}"
599+
550600 # ============================================================
551601 # Job 6: Build distribution packages
552602 # ============================================================
@@ -555,10 +605,10 @@ jobs:
555605 needs : prepare-release
556606 runs-on : ubuntu-latest
557607 steps :
558- - name : Checkout release tag
608+ - name : Checkout release commit
559609 uses : actions/checkout@v6
560610 with :
561- ref : ${{ inputs.dry_run == true && inputs.commit_sha || env.RELEASE_TAG }}
611+ ref : ${{ inputs.dry_run == true && inputs.commit_sha || env.RC_TAG }}
562612
563613 - name : Cache Java binaries
564614 id : cache-java
@@ -612,7 +662,7 @@ jobs:
612662 # ============================================================
613663 create-github-release :
614664 name : Create GitHub Release
615- needs : [build-distributions, wait-for-maven ]
665+ needs : [build-distributions, finalize-tag ]
616666 runs-on : ubuntu-latest
617667 if : ${{ inputs.dry_run != true }}
618668 steps :
@@ -628,6 +678,25 @@ jobs:
628678 name : release-distributions
629679 path : distributions
630680
681+ - name : Download Maven artifact
682+ continue-on-error : true
683+ run : |
684+ VERSION="${{ inputs.release_version }}"
685+ BASE_URL="https://repo1.maven.org/maven2/io/btrace/btrace/${VERSION}"
686+ mkdir -p maven-artifacts
687+ MAX_ATTEMPTS=40
688+ for i in $(seq 1 $MAX_ATTEMPTS); do
689+ if curl -fSL "${BASE_URL}/btrace-${VERSION}.jar" \
690+ -o maven-artifacts/btrace-${VERSION}.jar; then
691+ echo "Downloaded btrace-${VERSION}.jar"
692+ ls -la maven-artifacts/
693+ exit 0
694+ fi
695+ echo "Attempt ${i}/${MAX_ATTEMPTS} failed, retrying in 30s..."
696+ sleep 30
697+ done
698+ echo "::warning::Failed to download Maven JAR after ${MAX_ATTEMPTS} attempts (~20 minutes). GitHub release will proceed without it."
699+
631700 - name : Check for no-release-notes label
632701 id : check-label
633702 run : |
@@ -653,6 +722,7 @@ jobs:
653722 distributions/btrace-v${{ inputs.release_version }}-sdkman-bin.zip
654723 distributions/*.deb
655724 distributions/*.rpm
725+ maven-artifacts/*
656726
657727 # ============================================================
658728 # Job 8: Update SDKMan
@@ -861,7 +931,7 @@ jobs:
861931 # ============================================================
862932 summary :
863933 name : Release Summary
864- needs : [create-github-release, update-sdkman, update-milestones, update-jbang-catalog]
934+ needs : [create-github-release, update-sdkman, update-milestones, update-jbang-catalog, finalize-tag ]
865935 runs-on : ubuntu-latest
866936 if : always()
867937 steps :
@@ -915,6 +985,7 @@ jobs:
915985 echo "| Prepare Release | ${{ needs.prepare-release.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
916986 echo "| Stage Maven | ${{ needs.stage-maven.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
917987 echo "| Wait for Maven | ${{ needs.wait-for-maven.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
988+ echo "| Finalize Tag | ${{ needs.finalize-tag.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
918989 echo "| GitHub Release | ${{ needs.create-github-release.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
919990 echo "| SDKMan | ${{ needs.update-sdkman.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
920991 echo "| JBang Catalog | ${{ needs.update-jbang-catalog.result || 'skipped' }} |" >> $GITHUB_STEP_SUMMARY
0 commit comments