mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-13 14:51:51 -04:00
Fix[build]: Fallback for versions on shallow repositories (#4285)
This commit is contained in:
parent
e74e2e1205
commit
53d28026ac
1
.github/workflows/android.yml
vendored
1
.github/workflows/android.yml
vendored
@ -16,6 +16,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GPLAY_KEYSTORE_PASSWORD: ${{ secrets.GPLAY_KEYSTORE_PASSWORD }}
|
GPLAY_KEYSTORE_PASSWORD: ${{ secrets.GPLAY_KEYSTORE_PASSWORD }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Checkout
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up JDK 8
|
- name: Set up JDK 8
|
||||||
|
@ -16,28 +16,57 @@ def getVersionName = {
|
|||||||
// Get the last version tag, as well as the short head of the last commit
|
// Get the last version tag, as well as the short head of the last commit
|
||||||
ByteArrayOutputStream TAG = new ByteArrayOutputStream()
|
ByteArrayOutputStream TAG = new ByteArrayOutputStream()
|
||||||
ByteArrayOutputStream BRANCH = new ByteArrayOutputStream()
|
ByteArrayOutputStream BRANCH = new ByteArrayOutputStream()
|
||||||
|
// Used by the fallback for github actions
|
||||||
|
ByteArrayOutputStream TAG_PART_COMMIT = new ByteArrayOutputStream()
|
||||||
|
String TAG_STRING
|
||||||
|
|
||||||
exec {
|
exec {
|
||||||
try {
|
try {
|
||||||
commandLine 'git', 'describe', '--tags'
|
commandLine 'git', 'describe', '--tags'
|
||||||
ignoreExitValue true
|
ignoreExitValue true
|
||||||
standardOutput = TAG
|
standardOutput = TAG
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TAG.toString() == "") {
|
||||||
|
exec {
|
||||||
|
// Fallback for action builds
|
||||||
|
try {
|
||||||
|
commandLine 'git', 'describe', '--always', '--tags'
|
||||||
|
ignoreExitValue true
|
||||||
|
standardOutput = TAG_PART_COMMIT
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(TAG.toString() != ""){
|
||||||
|
TAG_STRING = TAG.toString()
|
||||||
|
}else {
|
||||||
|
if(TAG_PART_COMMIT.toString().trim() == ""){
|
||||||
|
//Fallback no repo
|
||||||
|
return ("LOCAL-" + "${getDate()}")
|
||||||
|
}else {
|
||||||
|
// Used by github actions
|
||||||
|
TAG_STRING = 'dahlia-' + "${getDate()}" + "-" + TAG_PART_COMMIT.toString().trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
exec {
|
exec {
|
||||||
try {
|
try {
|
||||||
commandLine 'git', 'branch', '--show-current'
|
commandLine 'git', 'branch', '--show-current'
|
||||||
ignoreExitValue true
|
ignoreExitValue true
|
||||||
standardOutput = BRANCH
|
standardOutput = BRANCH
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TAG.toString() == "") {
|
return TAG_STRING.trim().replace("-g", "-") + "-" + BRANCH.toString().trim()
|
||||||
return ("LOCAL-" + "${getDate()}")
|
|
||||||
}
|
|
||||||
|
|
||||||
return TAG.toString().trim().replace("-g", "-") + "-" + BRANCH.toString().trim()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user