ci: add a working ci (#5)

* ci: downgrade java version
* ci: make debug output file names different
* ci: update app name
This commit is contained in:
Aliberk Sandıkçı 2025-01-22 21:30:49 +03:00 committed by GitHub
parent be724964d0
commit 8c53d09029
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 5 deletions

View file

@ -46,7 +46,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
java-version: 17
distribution: "temurin"
cache: 'gradle'

View file

@ -3,7 +3,8 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 33
defaultConfig {
applicationId "us.spotco.malwarescanner"
applicationId "org.maintainteam.hypatia"
resValue "string", "app_name", "Hypatia"
minSdkVersion 16
targetSdkVersion 32
versionCode 314
@ -12,9 +13,23 @@ android {
}
buildTypes {
debug {
applicationIdSuffix ".debug"
debuggable true
// suffix the app id and the app name with git branch name
def workingBranch = getGitWorkingBranch()
def normalizedWorkingBranch = workingBranch.replaceFirst("^[^A-Za-z]+", "").replaceAll("[^0-9A-Za-z]+", "")
if (normalizedWorkingBranch.isEmpty() || workingBranch == "master" || workingBranch == "dev" || workingBranch == "stable") {
// default values when branch name could not be determined or is master, dev or stable
applicationIdSuffix ".debug"
resValue "string", "app_name", "Hypatia Debug"
} else {
applicationIdSuffix ".debug." + normalizedWorkingBranch
resValue "string", "app_name", "Hypatia " + workingBranch
}
minifyEnabled true
zipAlignEnabled true
}
release {
shrinkResources true
@ -40,3 +55,19 @@ dependencies {
implementation 'org.bouncycastle:bcpg-jdk15to18:1.77'
implementation 'com.google.guava:guava:33.0.0-jre'
}
static String getGitWorkingBranch() {
try {
def gitProcess = "git rev-parse --abbrev-ref HEAD".execute()
gitProcess.waitFor()
if (gitProcess.exitValue() == 0) {
return gitProcess.text.trim()
} else {
// not a git repository
return ""
}
} catch (IOException ignored) {
// git was not found
return ""
}
}

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">Hypatia</string>
<string name="app_copyright">Copyright 2017-2024 Divested Computing Group</string>
<string name="app_copyright">Copyright 2017-2024 Divested Computing Group, 2025 MaintainTeam</string>
<string name="app_license">License: GPL-3.0</string>
<string name="app_version">Version: %s</string>
<string name="app_db_type_clamav">Powered by ClamAV style signatures</string>