Debian Codegraph @

.github/workflows/prepare-release.yml

raw
1 name: Automation - Prepare Release
2
3 on:
4 workflow_dispatch:
5 # Determine the version number that will be assigned to the release. During the beta phase, we increment
6 # the minor version number and set the patch number to 0.
7 inputs:
8 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`.
14
15 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`.
21
22 permissions: read-all
23
24 jobs:
25 validate-versions-format:
26 runs-on: ubuntu-latest
27
28 steps:
29 - name: Validate version format
30 shell: bash
31 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 }
39
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 }
47
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"
52
53 if [[ ! -z "${{ inputs.candidate-stable }}" ]]; then
54 validate_stable_version "${{ inputs.candidate-stable }}" "candidate-stable"
55 fi
56 validate_stable_version "${{ inputs.current-stable }}" "current-stable"
57
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."
60 exit 1
61 fi
62
63 check-blockers:
64 needs:
65 - validate-versions-format
66 runs-on: ubuntu-latest
67 steps:
68 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
69 with:
70 fetch-depth: 0
71 # Make sure that there are no open issues with release:blocker label in Core. The release has to be delayed until they are resolved.
72 - name: Check blockers in core
73 env:
74 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75 REPO: open-telemetry/opentelemetry-collector
76 run: ./.github/workflows/scripts/release-check-blockers.sh
77 # Make sure that there are no open issues with release:blocker label in Contrib. The release has to be delayed until they are resolved.
78 - name: Check blockers in contrib
79 env:
80 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81 REPO: open-telemetry/opentelemetry-collector-contrib
82 run: ./.github/workflows/scripts/release-check-blockers.sh
83 # Make sure the current main branch build successfully passes (Core).
84 - name: Check build status in core
85 env:
86 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87 REPO: open-telemetry/opentelemetry-collector
88 run: ./.github/workflows/scripts/release-check-build-status.sh
89 # Make sure the current main branch build successfully passes (Contrib).
90 - name: Check build status in contrib
91 env:
92 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93 REPO: open-telemetry/opentelemetry-collector-contrib
94 run: ./.github/workflows/scripts/release-check-build-status.sh
95
96 create-release-issue:
97 needs:
98 - check-blockers
99 runs-on: ubuntu-latest
100 permissions:
101 issues: write
102 steps:
103 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
104 with:
105 fetch-depth: 0
106 # To keep track of the progress, it might be helpful to create a tracking issue similar to #6067. You are responsible
107 # for all of the steps under the "Performed by collector release manager" heading. Once the issue is created, you can
108 # create the individual ones by hovering them and clicking the "Convert to issue" button on the right hand side.
109 - name: Create issue for tracking release
110 env:
111 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 }}
116 REPO: open-telemetry/opentelemetry-collector
117 run: ./.github/workflows/scripts/release-create-tracking-issue.sh
118
119 # Releasing opentelemetry-collector
120 prepare-release:
121 needs:
122 - check-blockers
123 runs-on: ubuntu-latest
124 permissions:
125 contents: write
126 steps:
127 - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
128 with:
129 fetch-depth: 0
130 - name: Setup Go
131 uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
132 with:
133 go-version: stable
134 cache: false
135
136 - name: Cache Go
137 id: go-cache
138 uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
139 with:
140 path: |
141 ~/go/bin
142 ~/go/pkg/mod
143 key: go-cache-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/go.sum') }}
144
145 - uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0
146 id: otelbot-token
147 with:
148 app-id: ${{ vars.OTELBOT_APP_ID }}
149 private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
150 # Prepare Core for release.
151 # - Update CHANGELOG.md file, this is done via chloggen
152 # - Run make prepare-release PREVIOUS_VERSION=1.0.0 RELEASE_CANDIDATE=1.1.0 MODSET=stable
153 # - Run make prepare-release PREVIOUS_VERSION=0.52.0 RELEASE_CANDIDATE=0.53.0 MODSET=beta
154 - name: Prepare release for core
155 env:
156 GITHUB_TOKEN: ${{ steps.otelbot-token.outputs.token }}
157 REPO: open-telemetry/opentelemetry-collector
158 CANDIDATE_BETA: ${{ inputs.candidate-beta }}
159 CANDIDATE_STABLE: ${{ inputs.candidate-stable }}
160 CURRENT_BETA: ${{ inputs.current-beta }}
161 CURRENT_STABLE: ${{ inputs.current-stable }}
162 run: ./.github/workflows/scripts/release-prepare-release.sh