diff --git a/.github/scripts/verify_is_on_release_branch.sh b/.github/scripts/verify_is_on_release_branch.sh new file mode 100755 index 00000000..7730282f --- /dev/null +++ b/.github/scripts/verify_is_on_release_branch.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# This script verifies, that the current branch name starts with 'release-' + +CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) +if [[ "$CURRENT_BRANCH" == release-* ]]; then + echo "Branch name starts with 'release-'." +else + echo "Branch name does not start with 'release-'." + exit 1 +fi diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 8944e0da..010c282a 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -12,27 +12,17 @@ jobs: verify-release: name: Verify the release branch, tag and version runs-on: ubuntu-latest - steps: - name: Check if the desired version is valid run: .github/scripts/check_version_format.sh + - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Verify that the current branch has a name that starts with 'release-' - run: | - CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) - if [[ "$CURRENT_BRANCH" == release-* ]]; then - echo "Branch name starts with 'release-'." - else - echo "Branch name does not start with 'release-'." - exit 1 - fi - - - name: Check image Tag - run: ./scripts/check_tag_info.sh ${{ github.event.inputs.name }} + run: .github/scripts/verify_is_on_release_branch.sh create-draft: name: Create draft release diff --git a/scripts/check_tag_info.sh b/scripts/check_tag_info.sh deleted file mode 100755 index 28a5c8b9..00000000 --- a/scripts/check_tag_info.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -############################## -# Check tags in security-scan-config.yaml -# Image Tag, rc-tag -############################## - - -# Get release version -DESIRED_TAG="${1:-"main"}" - -# Get eventing-manager tag from sec-scanners-config.yaml -SEC_SCAN_TO_CHECK="${2:-europe-docker.pkg.dev/kyma-project/prod/eventing-manager}" -IMAGE_TAG=$(cat sec-scanners-config.yaml | grep "${SEC_SCAN_TO_CHECK}" | cut -d : -f 2) - -# Get rc-tag -RC_TAG_TO_CHECK="${3:-rc-tag}" -RC_TAG=$(cat sec-scanners-config.yaml | grep "${RC_TAG_TO_CHECK}" | cut -d : -f 2 | xargs) - -# Check IMAGE_TAG and required image tag -if [[ "$IMAGE_TAG" != "$DESIRED_TAG" ]] || [[ "$RC_TAG" != "$DESIRED_TAG" ]]; then - # ERROR: Tag issue - echo "Tags are not correct: - - wanted: $DESIRED_TAG - - security-scanner image tag: $IMAGE_TAG - - rc-tag: $RC_TAG" - exit 1 -fi - -# OK: Everything is fine -echo "Tags are correct" -exit 0