Skip to content

Commit 04c0e29

Browse files
authored
[chore] Calculate next versions automatically (#889)
* update input fields to dropdowns Signed-off-by: Moritz Wiesinger <[email protected]> * use actions to find correct next versions Signed-off-by: Moritz Wiesinger <[email protected]> * debugging Signed-off-by: Moritz Wiesinger <[email protected]> * clean up stable tag before moving on Signed-off-by: Moritz Wiesinger <[email protected]> * remove quotes Signed-off-by: Moritz Wiesinger <[email protected]> * remove quotes Signed-off-by: Moritz Wiesinger <[email protected]> * remove debug step Signed-off-by: Moritz Wiesinger <[email protected]> * try normal fetch depth with tags Signed-off-by: Moritz Wiesinger <[email protected]> * Revert "try normal fetch depth with tags" This reverts commit af40687. --------- Signed-off-by: Moritz Wiesinger <[email protected]>
1 parent ae5290d commit 04c0e29

File tree

1 file changed

+119
-15
lines changed

1 file changed

+119
-15
lines changed

.github/workflows/update-version.yaml

+119-15
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,30 @@ name: Update Version in Distributions and Prepare PR
22
on:
33
workflow_dispatch:
44
inputs:
5-
next_beta_core:
6-
description: 'Collector core beta module set version to update to. Leave empty to bump to next minor version (e.g. 0.120.1 -> 0.121.0)'
7-
required: false
8-
default: ''
9-
next_beta_contrib:
10-
description: 'Collector contrib beta module set version to update to. Leave empty to bump to next minor version (e.g. 0.120.1 -> 0.121.0)'
11-
required: false
12-
default: ''
13-
next_stable_core:
14-
description: 'Collector core stable module set version to update to. Leave empty to bump to next minor version (e.g. 1.26.0 -> 1.27.0)'
15-
required: false
16-
default: ''
5+
next_beta_core_text:
6+
description: 'Collector core beta module set version to update to (e.g. 0.120.1 -> 0.121.0)'
7+
required: true
8+
type: choice
9+
options:
10+
- minor
11+
- patch
12+
default: minor
13+
next_beta_contrib_text:
14+
description: 'Collector contrib beta module set version to update to (e.g. 0.120.1 -> 0.121.0)'
15+
required: true
16+
type: choice
17+
options:
18+
- minor
19+
- patch
20+
default: minor
21+
next_stable_core_text:
22+
description: 'Collector core stable module set version to update to (e.g. 1.26.0 -> 1.27.0)'
23+
required: true
24+
type: choice
25+
options:
26+
- minor
27+
- patch
28+
default: minor
1729

1830
jobs:
1931
update-version:
@@ -24,10 +36,102 @@ jobs:
2436
- name: Checkout repository
2537
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2638

39+
- name: Checkout Collector Core
40+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41+
with:
42+
fetch-depth: 0
43+
repository: "open-telemetry/opentelemetry-collector"
44+
path: opentelemetry-collector
45+
46+
- name: Checkout Collector Contrib
47+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
48+
with:
49+
fetch-depth: 0
50+
repository: "open-telemetry/opentelemetry-collector-contrib"
51+
path: opentelemetry-collector-contrib
52+
53+
- name: Get Previous tag for contrib
54+
id: previous-version-contrib
55+
uses: WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce # v1.4.0
56+
with:
57+
prefix: v0
58+
workingDirectory: opentelemetry-collector-contrib
59+
60+
- name: Get Previous tag for core beta
61+
id: previous-version-core-beta
62+
uses: WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce # v1.4.0
63+
with:
64+
prefix: v0
65+
workingDirectory: opentelemetry-collector
66+
67+
- name: Get Previous tag for core stable
68+
id: previous-version-core-stable
69+
uses: WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce # v1.4.0
70+
with:
71+
prefix: component/v1 # needs to be a tag of a stable component because major tags are not published
72+
workingDirectory: opentelemetry-collector
73+
74+
- name: Clean up core tag
75+
id: previous-version-core-stable-trimmed
76+
run: |
77+
monorepo_tag=${{ steps.previous-version-core-stable.outputs.tag }}
78+
echo "tag=${monorepo_tag#component/}" >> $GITHUB_OUTPUT
79+
80+
- name: Get next versions - contrib
81+
id: semvers-contrib
82+
uses: WyriHaximus/github-action-next-semvers@18aa9ed4152808ab99b88d71f5481e41f8d89930 # v1.2.1
83+
with:
84+
version: ${{ steps.previous-version-contrib.outputs.tag }}
85+
86+
- name: Get next versions - core beta
87+
id: semvers-core-beta
88+
uses: WyriHaximus/github-action-next-semvers@18aa9ed4152808ab99b88d71f5481e41f8d89930 # v1.2.1
89+
with:
90+
version: ${{ steps.previous-version-core-beta.outputs.tag }}
91+
92+
- name: Get next versions - core stable
93+
id: semvers-core-stable
94+
uses: WyriHaximus/github-action-next-semvers@18aa9ed4152808ab99b88d71f5481e41f8d89930 # v1.2.1
95+
with:
96+
version: ${{ steps.previous-version-core-stable-trimmed.outputs.tag }}
97+
98+
- name: Select next versions
99+
id: next-versions
100+
run: |
101+
# Contrib
102+
if [[ '${{ inputs.next_beta_contrib_text }}' == 'minor' ]]; then
103+
echo "next_beta_contrib=${{ steps.semvers-contrib.outputs.minor }}" >> $GITHUB_OUTPUT
104+
elif [[ '${{ inputs.next_beta_contrib_text }}' == 'patch' ]]; then
105+
echo "next_beta_contrib=${{ steps.semvers-contrib.outputs.patch }}" >> $GITHUB_OUTPUT
106+
else
107+
echo "Error: unsupported semver type for Collector Contrib"
108+
exit 1
109+
fi
110+
111+
# Core Beta
112+
if [[ '${{ inputs.next_beta_core_text }}' == 'minor' ]]; then
113+
echo "next_beta_core=${{ steps.semvers-core-beta.outputs.minor }}" >> $GITHUB_OUTPUT
114+
elif [[ '${{ inputs.next_beta_core_text }}' == 'patch' ]]; then
115+
echo "next_beta_core=${{ steps.semvers-core-beta.outputs.patch }}" >> $GITHUB_OUTPUT
116+
else
117+
echo "Error: unsupported semver type for Collector Core Beta"
118+
exit 1
119+
fi
120+
121+
# Core Stable
122+
if [[ '${{ inputs.next_stable_core_text }}' == 'minor' ]]; then
123+
echo "next_stable_core=${{ steps.semvers-core-stable.outputs.minor }}" >> $GITHUB_OUTPUT
124+
elif [[ '${{ inputs.next_stable_core_text }}' == 'patch' ]]; then
125+
echo "next_stable_core=${{ steps.semvers-core-stable.outputs.patch }}" >> $GITHUB_OUTPUT
126+
else
127+
echo "Error: unsupported semver type Collector Core Stable"
128+
exit 1
129+
fi
130+
27131
- name: Run bump-versions.sh
28132
run: |
29133
.github/workflows/scripts/bump-versions.sh --commit --pull-request
30134
env:
31-
next_beta_core: ${{ github.event.inputs.next_beta_core }}
32-
next_beta_contrib: ${{ github.event.inputs.next_beta_contrib }}
33-
next_stable_core: ${{ github.event.inputs.next_stable_core }}
135+
next_beta_core: ${{ steps.next-versions.outputs.next_beta_core }}
136+
next_beta_contrib: ${{ steps.next-versions.outputs.next_beta_contrib }}
137+
next_stable_core: ${{ steps.next-versions.outputs.next_stable_core }}

0 commit comments

Comments
 (0)