Skip to content

Commit

Permalink
chore(gradle): get git branch info from ci
Browse files Browse the repository at this point in the history
  • Loading branch information
tumuyan authored and Bambooin committed Jul 3, 2022
1 parent 9fb5c3d commit 05428eb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/commit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ jobs:
with:
fetch-depth: 0

- name: Get branch name
id: vars
run: |
echo ${GITHUB_REF#refs/*/}
echo CI_BRANCH=${GITHUB_REF#refs/*/} >> $GITHUB_ENV
- name: Calculate JNI cache hash
id: cache-hash
run: script/cache-hash.sh
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/pull-request-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ jobs:
with:
fetch-depth: 0

- name: Get branch name
id: vars
run: |
echo ${GITHUB_REF#refs/*/}
echo CI_BRANCH=${GITHUB_REF#refs/*/} >> $GITHUB_ENV
- name: Calculate JNI cache hash
id: cache-hash
run: script/cache-hash.sh
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ jobs:
with:
fetch-depth: 0

- name: Get branch name
id: vars
run: |
echo ${GITHUB_REF#refs/*/}
echo CI_BRANCH=${GITHUB_REF#refs/*/} >> $GITHUB_ENV
- name: Calculate JNI cache hash
id: cache-hash
run: script/cache-hash.sh
Expand Down
5 changes: 4 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ def getCommitInfo(){
}

def getGitBranch(){
' git symbolic-ref --short -q HEAD'.execute().text.trim()
def text = 'git symbolic-ref --short -q HEAD'.execute().text.trim()
if(text.length()<1)
return System.getenv("CI_BRANCH")
return text
}

def getGitVersion() {
Expand Down

0 comments on commit 05428eb

Please sign in to comment.