From 1b1343649e956c44759df7e99688e968ca9d9c29 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 18 Jan 2023 11:22:21 -0800 Subject: [PATCH] devops: check branch bash (#1174) --- .azure-pipelines/publish.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/publish.yml b/.azure-pipelines/publish.yml index 1f5d9872..6dc3d627 100644 --- a/.azure-pipelines/publish.yml +++ b/.azure-pipelines/publish.yml @@ -6,11 +6,13 @@ pool: steps: - bash: | - echo "Can only publish from a release branch. Unexpected branch name: $CURRENT_BRANCH" - exit 1 + if [[ ! "$CURRENT_BRANCH" =~ ^release-.* ]]; then + echo "Can only publish from a release branch." + echo "Unexpected branch name: $CURRENT_BRANCH" + exit 1 + fi env: CURRENT_BRANCH: ${{ variables['Build.SourceBranchName'] }} - condition: ${{ not(startsWith(variables['Build.SourceBranchName'], 'release-')) }} displayName: "Check the branch is a release branch" - bash: |