From e7eb3206d38f552417f6e90805729adc8f00b4a4 Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Fri, 1 Nov 2024 14:55:16 +0100 Subject: [PATCH 1/4] chore(ci): Publish - rework branch detector --- .github/workflows/publish.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 21c2de9e63b04..092aa5d319e68 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -791,16 +791,19 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Detect branch name id: detect_branch - env: - EVENT_BASE_REF: ${{ github.event.base_ref || 'tag_on_unknown_branch_commit_not_pushed' }} run: | - BRANCH=${EVENT_BASE_REF#refs/heads/} + GIT_BRANCHES=$(git branch -r --contains ${{ github.ref_name }}) + echo "Git contains: $GIT_BRANCHES" + + BRANCH="$(echo ${GIT_BRANCHES//origin\//} | tr -d '\n')" - if [ "$BRANCH" == "tag_on_unknown_branch_commit_not_pushed" ]; then - echo "Error: Could not detect branch name. Most likely this is that commit for tag is not pushed yet." - exit 1 + if [[ -z $BRANCH ]]; then + echo "Error: Could not detect branch name. Most likely this is that commit for tag is not pushed yet." + exit 1 fi echo "Detected branch: $BRANCH" From 7108a76f3459d75e57f9b034082d48d3892fb6a4 Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Fri, 1 Nov 2024 15:02:37 +0100 Subject: [PATCH 2/4] chore: tmp --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 092aa5d319e68..5754d0d34e717 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -796,7 +796,7 @@ jobs: - name: Detect branch name id: detect_branch run: | - GIT_BRANCHES=$(git branch -r --contains ${{ github.ref_name }}) + GIT_BRANCHES=$(git branch -r --contains "${{ github.ref_name }}") echo "Git contains: $GIT_BRANCHES" BRANCH="$(echo ${GIT_BRANCHES//origin\//} | tr -d '\n')" From b6ea53ed5456f45e69d5d4623b64a9b76be5438e Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Fri, 1 Nov 2024 15:03:43 +0100 Subject: [PATCH 3/4] chore: tmp --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5754d0d34e717..e2042ebc59d33 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -796,12 +796,12 @@ jobs: - name: Detect branch name id: detect_branch run: | - GIT_BRANCHES=$(git branch -r --contains "${{ github.ref_name }}") + GIT_BRANCHES=$(git branch -r --contains ${{ github.ref_name }}) echo "Git contains: $GIT_BRANCHES" BRANCH="$(echo ${GIT_BRANCHES//origin\//} | tr -d '\n')" - if [[ -z $BRANCH ]]; then + if [[ -z "$BRANCH" ]]; then echo "Error: Could not detect branch name. Most likely this is that commit for tag is not pushed yet." exit 1 fi From 02f090418ffd356b2bf77871d167eedbcf3a267f Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Fri, 1 Nov 2024 15:04:47 +0100 Subject: [PATCH 4/4] chore: tmp --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e2042ebc59d33..a29e1965c49f6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -799,7 +799,7 @@ jobs: GIT_BRANCHES=$(git branch -r --contains ${{ github.ref_name }}) echo "Git contains: $GIT_BRANCHES" - BRANCH="$(echo ${GIT_BRANCHES//origin\//} | tr -d '\n')" + BRANCH="$(echo "${GIT_BRANCHES//origin\//}" | tr -d '\n')" if [[ -z "$BRANCH" ]]; then echo "Error: Could not detect branch name. Most likely this is that commit for tag is not pushed yet."