Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
178 changes: 123 additions & 55 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ defaults:
env:
RELEASE_VERSION: ${{ inputs.release_version }}
RELEASE_TAG: v${{ inputs.release_version }}
RC_TAG: v${{ inputs.release_version }}_RC
IS_RC: ${{ inputs.release_type == 'rc' }}

jobs:
Expand Down Expand Up @@ -138,15 +137,6 @@ jobs:
echo "::error::Tag v${{ inputs.release_version }} already exists on remote"
exit 1
fi
# Check for leftover RC tag
if git rev-parse "${RC_TAG}" >/dev/null 2>&1; then
echo "::error::RC tag ${RC_TAG} already exists locally. Clean up with: git tag -d ${RC_TAG}"
exit 1
fi
if git ls-remote --tags origin "refs/tags/${RC_TAG}" | grep -q .; then
echo "::error::RC tag ${RC_TAG} already exists on remote. Clean up with: git push origin :refs/tags/${RC_TAG}"
exit 1
fi
echo "Tag does not exist - OK"

- name: Check if release branch exists
Expand Down Expand Up @@ -505,28 +495,33 @@ jobs:
echo "sha=${SHA}" >> $GITHUB_OUTPUT
echo "Release commit: ${SHA}"

- name: Create RC tag
if: ${{ inputs.dry_run != true }}
# Later jobs need the release commit before any tag names it, and a release candidate has
# no branch to carry it. Rather than an internal tag (the repository's tag rules forbid
# deleting one afterwards), hand it over as a bundle of the commits GitHub does not have.
# Created before the branch push below, which would leave nothing to bundle.
- name: Bundle the release commit
run: |
git tag -a "${RC_TAG}" -m "Release candidate ${RELEASE_TAG}"
echo "Created RC tag ${RC_TAG}"
git bundle create "${RUNNER_TEMP}/release-commit.bundle" HEAD --not --remotes=origin
git bundle list-heads "${RUNNER_TEMP}/release-commit.bundle"

- name: Upload the release commit
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: release-commit
retention-days: 7
path: ${{ runner.temp }}/release-commit.bundle

- name: Push branch and RC tag
if: ${{ inputs.dry_run != true }}
- name: Push release branch
if: ${{ inputs.dry_run != true && inputs.release_type != 'rc' }}
run: |
if [[ "${IS_RC}" != "true" ]]; then
git push origin "${{ inputs.release_branch }}"
fi
git push origin "${RC_TAG}"
echo "Pushed release commit and RC tag"
git push origin "${{ inputs.release_branch }}"
echo "Pushed release branch ${{ inputs.release_branch }}"

- name: Dry run summary
if: ${{ inputs.dry_run == true }}
run: |
echo "::warning::DRY RUN - Branch and tag NOT pushed"
echo "Would have pushed:"
echo " - Branch: ${{ inputs.release_branch }}"
echo " - RC Tag: ${RC_TAG}"
echo "::warning::DRY RUN - release branch NOT pushed"
echo "Would have pushed branch: ${{ inputs.release_branch }}"

# ============================================================
# Job 5: Stage to Maven Central (does NOT release)
Expand All @@ -537,10 +532,25 @@ jobs:
runs-on: ubuntu-latest
if: ${{ inputs.dry_run != true }}
steps:
- name: Checkout RC tag
- name: Checkout source commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ env.RC_TAG }}
ref: ${{ inputs.commit_sha }}
fetch-depth: 0

- name: Download the release commit
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: release-commit
path: ${{ runner.temp }}/release-commit

- name: Check out the release commit
# prepare-release pushes no ref for it (a release candidate has no branch); it travels
# as a bundle whose prerequisites are on GitHub, hence the full-history checkout above
run: |
git fetch --no-tags "${RUNNER_TEMP}/release-commit/release-commit.bundle"
git checkout --detach "${{ needs.prepare-release.outputs.release_sha }}"
test "$(git rev-parse HEAD)" = "${{ needs.prepare-release.outputs.release_sha }}"

- name: Set up Java 8 (Gradle toolchain; the ubuntu-26.04 runner image has no JDK 8)
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6
Expand Down Expand Up @@ -671,10 +681,25 @@ jobs:
runs-on: ubuntu-latest
if: ${{ inputs.dry_run != true }}
steps:
- name: Checkout RC tag
- name: Checkout source commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ env.RC_TAG }}
ref: ${{ inputs.commit_sha }}
fetch-depth: 0

- name: Download the release commit
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: release-commit
path: ${{ runner.temp }}/release-commit

- name: Check out the release commit
# prepare-release pushes no ref for it (a release candidate has no branch); it travels
# as a bundle whose prerequisites are on GitHub, hence the full-history checkout above
run: |
git fetch --no-tags "${RUNNER_TEMP}/release-commit/release-commit.bundle"
git checkout --detach "${{ needs.prepare-release.outputs.release_sha }}"
test "$(git rev-parse HEAD)" = "${{ needs.prepare-release.outputs.release_sha }}"

- name: Set up JDK 17
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6
Expand Down Expand Up @@ -818,13 +843,27 @@ jobs:
runs-on: ubuntu-latest
if: ${{ inputs.dry_run != true }}
steps:
- name: Checkout at release SHA
- name: Checkout source commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ needs.prepare-release.outputs.release_sha }}
ref: ${{ inputs.commit_sha }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Download the release commit
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: release-commit
path: ${{ runner.temp }}/release-commit

- name: Check out the release commit
# prepare-release pushes no ref for it (a release candidate has no branch); it travels
# as a bundle whose prerequisites are on GitHub, hence the full-history checkout above
run: |
git fetch --no-tags "${RUNNER_TEMP}/release-commit/release-commit.bundle"
git checkout --detach "${{ needs.prepare-release.outputs.release_sha }}"
test "$(git rev-parse HEAD)" = "${{ needs.prepare-release.outputs.release_sha }}"

- name: Fetch tags
run: git fetch origin --tags

Expand All @@ -839,16 +878,11 @@ jobs:
echo "Created final tag ${RELEASE_TAG}"

- name: Push final tag
# Pushing the tag also uploads the release commit, which for a candidate is on no branch
run: |
git push origin "${RELEASE_TAG}"
echo "Pushed final tag ${RELEASE_TAG}"

- name: Delete RC tag
run: |
git tag -d "${RC_TAG}" || true
git push origin ":refs/tags/${RC_TAG}" || true
echo "Deleted RC tag ${RC_TAG}"

# ============================================================
# Job 6: Build distribution packages
# ============================================================
Expand All @@ -857,10 +891,25 @@ jobs:
needs: prepare-release
runs-on: ubuntu-latest
steps:
- name: Checkout release commit
- name: Checkout source commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ inputs.dry_run == true && inputs.commit_sha || env.RC_TAG }}
ref: ${{ inputs.commit_sha }}
fetch-depth: 0

- name: Download the release commit
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: release-commit
path: ${{ runner.temp }}/release-commit

- name: Check out the release commit
# prepare-release pushes no ref for it (a release candidate has no branch); it travels
# as a bundle whose prerequisites are on GitHub, hence the full-history checkout above
run: |
git fetch --no-tags "${RUNNER_TEMP}/release-commit/release-commit.bundle"
git checkout --detach "${{ needs.prepare-release.outputs.release_sha }}"
test "$(git rev-parse HEAD)" = "${{ needs.prepare-release.outputs.release_sha }}"

- name: Set up Java 8 (Gradle toolchain; the ubuntu-26.04 runner image has no JDK 8)
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6
Expand All @@ -885,18 +934,6 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6

- name: Update version for dry run
if: ${{ inputs.dry_run == true }}
run: |
VERSION="${{ inputs.release_version }}"
# `version = '...'` lives in build.gradle since c354f12b; 2.2.x release branches keep
# `project.version = '...'` in common.gradle. Edit whichever file the checkout carries.
VERSION_FILE=build.gradle
grep -qE "^[[:space:]]*version = '" build.gradle || VERSION_FILE=common.gradle
sed -i -E "s/^([[:space:]]*(project\.)?version = )'[^']*'/\1'${VERSION}'/" "${VERSION_FILE}"
echo "VERSION_FILE=${VERSION_FILE}" >> "$GITHUB_ENV"
grep -E "^[[:space:]]*(project\.)?version = '" "${VERSION_FILE}"

- name: Build distribution packages from a clean tree
run: |
./gradlew clean :btrace-dist:build --no-daemon
Expand Down Expand Up @@ -928,10 +965,25 @@ jobs:
timeout-minutes: 25
if: ${{ inputs.dry_run != true }}
steps:
- name: Checkout release commit
- name: Checkout source commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ needs.prepare-release.outputs.release_sha }}
ref: ${{ inputs.commit_sha }}
fetch-depth: 0

- name: Download the release commit
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: release-commit
path: ${{ runner.temp }}/release-commit

- name: Check out the release commit
# prepare-release pushes no ref for it (a release candidate has no branch); it travels
# as a bundle whose prerequisites are on GitHub, hence the full-history checkout above
run: |
git fetch --no-tags "${RUNNER_TEMP}/release-commit/release-commit.bundle"
git checkout --detach "${{ needs.prepare-release.outputs.release_sha }}"
test "$(git rev-parse HEAD)" = "${{ needs.prepare-release.outputs.release_sha }}"

- name: Set up Java 8 (Gradle toolchain; the ubuntu-26.04 runner image has no JDK 8)
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6
Expand Down Expand Up @@ -1141,10 +1193,25 @@ jobs:
env:
IMAGE_REPOSITORY: ghcr.io/${{ github.repository_owner }}/btrace
steps:
- name: Checkout release commit
- name: Checkout source commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ needs.prepare-release.outputs.release_sha }}
ref: ${{ inputs.commit_sha }}
fetch-depth: 0

- name: Download the release commit
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: release-commit
path: ${{ runner.temp }}/release-commit

- name: Check out the release commit
# prepare-release pushes no ref for it (a release candidate has no branch); it travels
# as a bundle whose prerequisites are on GitHub, hence the full-history checkout above
run: |
git fetch --no-tags "${RUNNER_TEMP}/release-commit/release-commit.bundle"
git checkout --detach "${{ needs.prepare-release.outputs.release_sha }}"
test "$(git rev-parse HEAD)" = "${{ needs.prepare-release.outputs.release_sha }}"

- name: Download release distributions
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
Expand Down Expand Up @@ -1520,3 +1587,4 @@ jobs:
name: |
dist-build
test-trace
release-commit
2 changes: 1 addition & 1 deletion docs/ReleaseChecklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ decision.
|-------|-------|
| Version | |
| Source commit | |
| RC tag | |
| Release commit (Prepare Release output) | |
| Workflow run | |
| Release owner | |
| Decision (`GO` / `NO-GO`) | |
Expand Down
12 changes: 5 additions & 7 deletions docs/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ its own `.github/release-notes/vX.Y.Z-RCn.md` (start from the previous candidate
`vX.Y.Z.md` with the links, download names, coordinates and image tags changed to the candidate);
without it the pre-release has only the generated list.

The workflow's internal `vX.Y.Z_RC` tag (created before the smoke tests and replaced by the final
tag) is unrelated: it exists for every run, candidates included.
The release commit is pushed under no tag until the release-smoke job has passed: the jobs between
Prepare Release and Finalize Release Tag receive it as a `release-commit` workflow artifact (a git
bundle). Earlier versions of the workflow parked it under an internal `vX.Y.Z_RC` tag, which the
repository's tag rules then kept from being deleted; such leftover tags can be ignored.

### What Happens During Release

Expand Down Expand Up @@ -246,11 +248,7 @@ If the workflow is waiting for Maven Central and you want to abort:

1. **Cancel the workflow** in GitHub Actions
2. **Drop the staging repository** via [Central Portal](https://central.sonatype.com/publishing/deployments)
3. **Delete the tag** (if created). At this point only the workflow's internal `vX.Y.Z_RC` tag exists (the final `vX.Y.Z` tag is created after the release-smoke job), and the next run's validation fails while it is there:
```bash
git tag -d vX.Y.Z_RC
git push origin :refs/tags/vX.Y.Z_RC
```
3. No tag needs deleting: the final `vX.Y.Z` tag is only created after the release-smoke job.
4. **Reset release branch** if needed:
```bash
git checkout release/X.Y._
Expand Down
12 changes: 0 additions & 12 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -554,18 +554,6 @@ check_tag_exists() {
exit 1
fi

# Check for leftover RC tag (locally and on remote)
if git rev-parse "v${tag}_RC" &> /dev/null; then
error "RC tag v${tag}_RC already exists locally."
error "Clean up with: git tag -d v${tag}_RC"
exit 1
fi

if git ls-remote --tags origin "refs/tags/v${tag}_RC" | grep -q .; then
error "RC tag v${tag}_RC already exists on remote."
error "Clean up with: git push origin :refs/tags/v${tag}_RC && git tag -d v${tag}_RC"
exit 1
fi
}

#######################################
Expand Down
Loading