Skip to content

Commit b6fa6c2

Browse files
authored
properly get branch name (ITISFoundation#2970)
1 parent 5c09b8f commit b6fa6c2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.github/workflows/ci-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
fetch-depth: 0
3535
- name: find branch name
3636
shell: bash
37-
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
37+
run: echo "BRANCH_NAME=$(git name-rev --refs="refs/remotes/origin/master" --refs="refs/remotes/origin/hotfix_v*" --refs="refs/remotes/origin/hotfix_staging_*" --name-only ${GITHUB_SHA})" >> $GITHUB_ENV
3838

3939
- name: setup docker buildx
4040
id: buildx
@@ -51,12 +51,12 @@ jobs:
5151
- name: show system environs
5252
if: github.event_name == 'push'
5353
run: ./ci/helpers/show_system_versions.bash
54-
- if: contains(env.BRANCH_NAME, 'master')
54+
- if: contains(env.BRANCH_NAME, 'remotes/origin/master')
5555
env:
5656
FROM_TAG_PREFIX: staging-github
5757
name: deploy
5858
run: ./ci/deploy/dockerhub-tag-version.bash
59-
- if: contains(env.BRANCH_NAME, 'hotfix_v')
59+
- if: contains(env.BRANCH_NAME, 'remotes/origin/hotfix_v')
6060
env:
6161
FROM_TAG_PREFIX: hotfix-github
6262
name: deploy from hotfix image

.github/workflows/ci-staging.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
fetch-depth: 0
3434
- name: find branch name
3535
shell: bash
36-
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
36+
run: echo "BRANCH_NAME=$(git name-rev --refs="refs/remotes/origin/master" --refs="refs/remotes/origin/hotfix_v*" --refs="refs/remotes/origin/hotfix_staging_*" --name-only ${GITHUB_SHA})" >> $GITHUB_ENV
3737

3838
- name: setup docker buildx
3939
id: buildx
@@ -50,12 +50,12 @@ jobs:
5050
- name: show system environs
5151
if: github.event_name == 'push'
5252
run: ./ci/helpers/show_system_versions.bash
53-
- if: contains(env.BRANCH_NAME, 'master')
53+
- if: contains(env.BRANCH_NAME, 'remotes/origin/master')
5454
env:
5555
FROM_TAG_PREFIX: master-github
5656
name: deploy from master to staging
5757
run: ./ci/deploy/dockerhub-tag-version.bash
58-
- if: contains(env.BRANCH_NAME, 'hotfix_staging_')
58+
- if: contains(env.BRANCH_NAME, 'remotes/origin/hotfix_staging_')
5959
env:
6060
FROM_TAG_PREFIX: hotfix-staging-github
6161
name: deploy from hotfix staging to staging

0 commit comments

Comments
 (0)