From fbd85e02bd03a144a6b96d4b5fd6b6b4c6e1594c Mon Sep 17 00:00:00 2001 From: PaoloGallina Date: Wed, 28 Jun 2023 22:20:43 +0200 Subject: [PATCH] [admin] feat(ci/cd): add version validation to prepare-release (#23818) **Description:** Adding version validation to prepare-release I used the same regex already used in [set_release_tag.sh](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/7e74bd350192456ded06ae80fb5586bec921f2e0/.github/workflows/scripts/set_release_tag.sh#L7), just without the v. **Link to tracking Issue:** https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/21490 --- .../workflows/scripts/release-prepare-release.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/scripts/release-prepare-release.sh b/.github/workflows/scripts/release-prepare-release.sh index a979a8cd0249..889bb23d2f1a 100755 --- a/.github/workflows/scripts/release-prepare-release.sh +++ b/.github/workflows/scripts/release-prepare-release.sh @@ -3,6 +3,19 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 +PATTERN="^[0-9]+\.[0-9]+\.[0-9]+.*" +if ! [[ ${CURRENT_BETA} =~ $PATTERN ]] +then + echo "CURRENT_BETA should follow a semver format and not be led by a v" + exit 1 +fi + +if ! [[ ${CANDIDATE_BETA} =~ $PATTERN ]] +then + echo "CANDIDATE_BETA should follow a semver format and not be led by a v" + exit 1 +fi + make chlog-update VERSION="v${CANDIDATE_BETA}" git config user.name opentelemetrybot git config user.email 107717825+opentelemetrybot@users.noreply.github.com