From 9c53f0b3e65547e85f211d5c0c2b5c2f0f41e8fd Mon Sep 17 00:00:00 2001 From: Moritz Wiesinger Date: Wed, 7 Aug 2024 10:58:53 +0200 Subject: [PATCH 1/3] [chore] improve release version validations Signed-off-by: Moritz Wiesinger --- .github/workflows/prepare-release.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 5074ed2acfe..5b9b48d57f2 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -25,6 +25,7 @@ jobs: steps: - name: Validate version format + shell: bash run: | validate_beta_version() { local regex_pattern_beta='^[0-9]+\.[0-9]+\.[0-9]+$' @@ -42,13 +43,15 @@ jobs: fi } - validate_beta_version "${{ inputs.candidate-beta }}" "candidate-beta" + if [[ ! -z "${{ inputs.candidate-beta }}" ]]; then + validate_beta_version "${{ inputs.candidate-beta }}" "candidate-beta" + fi validate_beta_version "${{ inputs.current-beta }}" "current-beta" + if [[ ! -z "${{ inputs.candidate-stable }}" ]]; then validate_stable_version "${{ inputs.candidate-stable }}" "candidate-stable" fi validate_stable_version "${{ inputs.current-stable }}" "current-stable" - shell: bash # Releasing opentelemetry-collector prepare-release: From 631caf6d35b4f4d23dda0e46bbf6713b07a71de2 Mon Sep 17 00:00:00 2001 From: Moritz Wiesinger Date: Wed, 7 Aug 2024 11:04:49 +0200 Subject: [PATCH 2/3] also check that any candidate version is set Signed-off-by: Moritz Wiesinger --- .github/workflows/prepare-release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 5b9b48d57f2..1074bb0bd43 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -52,6 +52,11 @@ jobs: validate_stable_version "${{ inputs.candidate-stable }}" "candidate-stable" fi validate_stable_version "${{ inputs.current-stable }}" "current-stable" + + if [[ -z "${{ inputs.candidate-beta }}" && -z "${{ inputs.candidate-stable }}" ]]; then + echo "Candidate version is not set for beta or stable. Please set a version to proceed." + exit 1 + fi # Releasing opentelemetry-collector prepare-release: From b03017e893d61fab6b56738c16baaee14a9530cb Mon Sep 17 00:00:00 2001 From: Moritz Wiesinger Date: Wed, 7 Aug 2024 11:07:08 +0200 Subject: [PATCH 3/3] remove extra whitespaces Signed-off-by: Moritz Wiesinger --- .github/workflows/prepare-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 1074bb0bd43..cf0fd7621d3 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -47,12 +47,12 @@ jobs: validate_beta_version "${{ inputs.candidate-beta }}" "candidate-beta" fi validate_beta_version "${{ inputs.current-beta }}" "current-beta" - + if [[ ! -z "${{ inputs.candidate-stable }}" ]]; then validate_stable_version "${{ inputs.candidate-stable }}" "candidate-stable" fi validate_stable_version "${{ inputs.current-stable }}" "current-stable" - + if [[ -z "${{ inputs.candidate-beta }}" && -z "${{ inputs.candidate-stable }}" ]]; then echo "Candidate version is not set for beta or stable. Please set a version to proceed." exit 1