Skip to content

Commit a624a45

Browse files
authored
[chore] Auto-populate versions during release preparation (#12733)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This PR updated the prepare-release workflow so that the version bump just needs to be selected in a dropdown menu instead of putting in the version numbers by hand. Additionally, "no bump" can be selected to not bump specific component sets (beta or stable). <!-- Issue number if applicable --> #### Link to tracking issue Fixes #12565 <!--Describe what testing was performed and which tests were added.--> #### Testing Only bumping beta to next minor: [workflow run](https://github.com/mowies/opentelemetry-collector/actions/runs/14059792536) - [release tracker issue](mowies#17) Bumping beta and stable to next minor: [workflow run](https://github.com/mowies/opentelemetry-collector/actions/runs/14058979304/job/39364990356) - [release tracker issue](mowies#16) Bumping beta and stable to next patch: [workflow run](https://github.com/mowies/opentelemetry-collector/actions/runs/14059861157) <!--Please delete paragraphs that you did not use before submitting.--> --------- Signed-off-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>
1 parent 1096f8e commit a624a45

File tree

2 files changed

+84
-49
lines changed

2 files changed

+84
-49
lines changed

.github/workflows/prepare-release.yml

+81-46
Original file line numberDiff line numberDiff line change
@@ -6,63 +6,96 @@ on:
66
# the minor version number and set the patch number to 0.
77
inputs:
88
candidate-stable:
9-
description: Release candidate version (stable, like 1.3.0). Don't include a leading `v`.
10-
11-
current-stable:
12-
required: true
13-
description: Current version (stable, like 1.2.0). Don't include a leading `v`.
9+
description: Release candidate version bump (stable).
10+
type: choice
11+
options:
12+
- minor
13+
- patch
14+
- "no bump"
15+
default: minor
1416

1517
candidate-beta:
16-
description: Release candidate version (beta, like 0.96.0). Don't include `v`.
17-
18-
current-beta:
19-
required: true
20-
description: Current version (beta, like 0.95.1). Don't include `v`.
18+
description: Release candidate version bump (beta).
19+
type: choice
20+
options:
21+
- minor
22+
- patch
23+
default: minor
2124

2225
permissions: read-all
2326

2427
jobs:
25-
validate-versions-format:
28+
extract-versions:
29+
outputs:
30+
current-beta: ${{ steps.current-version-core-beta.outputs.tags }}
31+
current-stable: ${{ steps.current-version-core-stable-trimmed.outputs.tag }}
32+
next-beta: ${{ steps.next-versions.outputs.next_beta }}
33+
next-stable: ${{ steps.next-versions.outputs.next_stable }}
2634
runs-on: ubuntu-latest
2735

2836
steps:
29-
- name: Validate version format
30-
shell: bash
37+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Get current tag for core beta
42+
id: current-version-core-beta
43+
uses: WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce # v1.4.0
44+
with:
45+
prefix: v0
46+
47+
- name: Get current tag for core stable
48+
id: current-version-core-stable
49+
uses: WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce # v1.4.0
50+
with:
51+
prefix: component/v1 # needs to be a tag of a stable component because major tags are not published
52+
53+
- name: Clean up core tag
54+
id: current-version-core-stable-trimmed
3155
run: |
32-
validate_beta_version() {
33-
local regex_pattern_beta='^[0-9]+\.[0-9]+\.[0-9]+$'
34-
if [[ ! "$1" =~ $regex_pattern_beta ]]; then
35-
echo "Invalid $2 version format. For beta, it can be 0.1.0 or higher"
36-
exit 1
37-
fi
38-
}
56+
monorepo_tag=${{ steps.current-version-core-stable.outputs.tag }}
57+
echo "tag=${monorepo_tag#component/}" >> $GITHUB_OUTPUT
3958
40-
validate_stable_version() {
41-
local regex_pattern_stable='^[1-9][0-9]*\.[0-9]+\.[0-9]+$'
42-
if [[ ! "$1" =~ $regex_pattern_stable ]]; then
43-
echo "Invalid stable version format for $2. Major version must be greater than 1."
44-
exit 1
45-
fi
46-
}
59+
- name: Get next versions - beta
60+
id: semvers-beta
61+
uses: WyriHaximus/github-action-next-semvers@18aa9ed4152808ab99b88d71f5481e41f8d89930 # v1.2.1
62+
with:
63+
version: ${{ steps.current-version-core-beta.outputs.tag }}
4764

48-
if [[ ! -z "${{ inputs.candidate-beta }}" ]]; then
49-
validate_beta_version "${{ inputs.candidate-beta }}" "candidate-beta"
50-
fi
51-
validate_beta_version "${{ inputs.current-beta }}" "current-beta"
65+
- name: Get next versions - stable
66+
id: semvers-stable
67+
uses: WyriHaximus/github-action-next-semvers@18aa9ed4152808ab99b88d71f5481e41f8d89930 # v1.2.1
68+
with:
69+
version: ${{ steps.current-version-core-stable-trimmed.outputs.tag }}
5270

53-
if [[ ! -z "${{ inputs.candidate-stable }}" ]]; then
54-
validate_stable_version "${{ inputs.candidate-stable }}" "candidate-stable"
71+
- name: Select next versions
72+
id: next-versions
73+
run: |
74+
# Candidate Beta
75+
if [[ '${{ inputs.candidate-beta }}' == 'minor' ]]; then
76+
echo "next_beta=${{ steps.semvers-beta.outputs.minor }}" >> $GITHUB_OUTPUT
77+
elif [[ '${{ inputs.candidate-beta }}' == 'patch' ]]; then
78+
echo "next_beta=${{ steps.semvers-beta.outputs.patch }}" >> $GITHUB_OUTPUT
79+
elif [[ '${{ inputs.candidate-beta }}' == 'no bump' ]]; then
80+
echo "next_beta=" >> $GITHUB_OUTPUT
81+
else
82+
echo "Error: unsupported semver type for Candidate Beta"
83+
exit 1
5584
fi
56-
validate_stable_version "${{ inputs.current-stable }}" "current-stable"
5785
58-
if [[ -z "${{ inputs.candidate-beta }}" && -z "${{ inputs.candidate-stable }}" ]]; then
59-
echo "Candidate version is not set for beta or stable. Please set a version to proceed."
86+
# Candidate Stable
87+
if [[ '${{ inputs.candidate-stable }}' == 'minor' ]]; then
88+
echo "next_stable=${{ steps.semvers-stable.outputs.minor }}" >> $GITHUB_OUTPUT
89+
elif [[ '${{ inputs.candidate-stable }}' == 'patch' ]]; then
90+
echo "next_stable=${{ steps.semvers-stable.outputs.patch }}" >> $GITHUB_OUTPUT
91+
elif [[ '${{ inputs.candidate-stable }}' == 'no bump' ]]; then
92+
echo "next_stable=" >> $GITHUB_OUTPUT
93+
else
94+
echo "Error: unsupported semver type Candidate Stable"
6095
exit 1
6196
fi
6297
6398
check-blockers:
64-
needs:
65-
- validate-versions-format
6699
runs-on: ubuntu-latest
67100
steps:
68101
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -96,6 +129,7 @@ jobs:
96129
create-release-issue:
97130
needs:
98131
- check-blockers
132+
- extract-versions
99133
runs-on: ubuntu-latest
100134
permissions:
101135
issues: write
@@ -109,17 +143,18 @@ jobs:
109143
- name: Create issue for tracking release
110144
env:
111145
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112-
CANDIDATE_BETA: ${{ inputs.candidate-beta }}
113-
CANDIDATE_STABLE: ${{ inputs.candidate-stable }}
114-
CURRENT_BETA: ${{ inputs.current-beta }}
115-
CURRENT_STABLE: ${{ inputs.current-stable }}
146+
CANDIDATE_BETA: ${{ needs.extract-versions.outputs.next-beta }}
147+
CANDIDATE_STABLE: ${{ needs.extract-versions.outputs.next-stable }}
148+
CURRENT_BETA: ${{ needs.extract-versions.outputs.current-beta }}
149+
CURRENT_STABLE: ${{ needs.extract-versions.outputs.current-stable }}
116150
REPO: open-telemetry/opentelemetry-collector
117151
run: ./.github/workflows/scripts/release-create-tracking-issue.sh
118152

119153
# Releasing opentelemetry-collector
120154
prepare-release:
121155
needs:
122156
- check-blockers
157+
- extract-versions
123158
runs-on: ubuntu-latest
124159
permissions:
125160
contents: write
@@ -139,8 +174,8 @@ jobs:
139174
env:
140175
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
141176
REPO: open-telemetry/opentelemetry-collector
142-
CANDIDATE_BETA: ${{ inputs.candidate-beta }}
143-
CANDIDATE_STABLE: ${{ inputs.candidate-stable }}
144-
CURRENT_BETA: ${{ inputs.current-beta }}
145-
CURRENT_STABLE: ${{ inputs.current-stable }}
177+
CANDIDATE_BETA: ${{ needs.extract-versions.outputs.next-beta }}
178+
CANDIDATE_STABLE: ${{ needs.extract-versions.outputs.next-stable }}
179+
CURRENT_BETA: ${{ needs.extract-versions.outputs.current-beta }}
180+
CURRENT_STABLE: ${{ needs.extract-versions.outputs.current-stable }}
146181
run: ./.github/workflows/scripts/release-prepare-release.sh

docs/release.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ Before the release, make sure there are no open release blockers in [core](https
3838
insignificant, consider not releasing a new version for stable modules.
3939

4040
3. Manually run the action [Automation - Prepare Release](https://github.com/open-telemetry/opentelemetry-collector/actions/workflows/prepare-release.yml). This action will create an issue to track the progress of the release and a pull request to update the changelog and version numbers in the repo.
41-
- When prompted, enter the version numbers determined in Step 2, but do not include a leading `v`.
42-
- If not intending to release stable modules, do not specify a version for `Release candidate version stable`.
41+
- When prompted, enter the version bumps that are needed.
42+
- If not intending to release stable modules, do not specify a version for `Release candidate version bump (stable)`.
4343
- While this PR is open all merging in Core is automatically halted via the `Merge freeze / Check` CI check.
4444
- If the PR needs updated in any way you can make the changes in a fork and PR those changes into the `prepare-release-prs/x` branch. You do not need to wait for the CI to pass in this prep-to-prep PR.
4545
- 🛑 **Do not move forward until this PR is merged.** 🛑
@@ -227,4 +227,4 @@ Once a module is ready to be released under the `1.x` version scheme, file a PR
227227
| 2025-07-14 | v0.130.0 | [@jade-guiton-dd](https://github.com/jade-guiton-dd) |
228228
| 2025-07-28 | v0.131.0 | [@jmacd](https://github.com/jmacd) |
229229
| 2025-08-11 | v0.132.0 | [@mx-psi](https://github.com/mx-psi) |
230-
| 2025-08-18 | v0.133.0 | [@evan-bradley](https://github.com/evan-bradley) |
230+
| 2025-08-18 | v0.133.0 | [@evan-bradley](https://github.com/evan-bradley) |

0 commit comments

Comments
 (0)