Skip to content

Commit

Permalink
Updated build
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminHalko committed Jan 23, 2024
1 parent a1bf955 commit 1974659
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 34 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,10 @@ jobs:
uses: gradle/gradle-build-action@v2

- name: Build with Gradle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew assembleRelease --no-daemon -PnoProguard -PsignAsDebug

- name: Set env
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Add hash to APK
run: mv app/build/outputs/apk/release/app-release.apk revanced-manager-${{ env.COMMIT_HASH }}.apk
run: ./gradlew assembleRelease --no-daemon -PnoProguard

- name: Upload build
uses: actions/upload-artifact@v3
with:
name: revanced-manager
path: revanced-manager-${{ env.COMMIT_HASH }}.apk
path: app/build/outputs/apk/release/*.apk
48 changes: 24 additions & 24 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,46 +25,46 @@ android {
vectorDrawables.useSupportLibrary = true
}

val hasReleaseConfig = (System.getenv("KEYSTORE_FILE") != null)
signingConfigs {
if (hasReleaseConfig) {
create("release") {
storeFile = file(System.getenv("KEYSTORE_FILE"))
storePassword = System.getenv("KEYSTORE_PASSWORD")
keyAlias = System.getenv("KEY_ALIAS")
keyPassword = System.getenv("KEY_PASSWORD")
}
}
}

buildTypes {
debug {
applicationIdSuffix = ".debug"
resValue("string", "app_name", "ReVanced Manager Debug")
}

release {
val hasReleaseConfig = (System.getenv("KEYSTORE_FILE") != null)
var suffix = "v${project.version}"
if (hasReleaseConfig) {
signingConfigs {
create("release") {
storeFile = file(System.getenv("KEYSTORE_FILE"))
storePassword = System.getenv("KEYSTORE_PASSWORD")
keyAlias = System.getenv("KEY_ALIAS")
keyPassword = System.getenv("KEY_PASSWORD")
}
}
signingConfig = signingConfigs.getByName("release")
} else {
applicationIdSuffix = ".debug"
resValue("string", "app_name", "ReVanced Manager Debug")
signingConfig = signingConfigs.getByName("debug")
val os = org.apache.commons.io.output.ByteArrayOutputStream()
project.exec {
commandLine = "git rev-parse --short HEAD".split(" ")
standardOutput = os
}
suffix = String(os.toByteArray()).trim()
}
if (!project.hasProperty("noProguard")) {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
if (!hasReleaseConfig) {
applicationIdSuffix = ".debug"
resValue("string", "app_name", "ReVanced Manager Debug")
signingConfig = signingConfigs.getByName("debug")
} else {
signingConfig = signingConfigs.getByName("release")
}
applicationVariants.all {
this.outputs
.map { it as com.android.build.gradle.internal.api.BaseVariantOutputImpl }
.forEach { output ->
if (applicationIdSuffix == ".debug") {
output.outputFileName = "revanced-manager-v${project.version}-debug.apk"
} else {
output.outputFileName = "revanced-manager-v${project.version}.apk"
}
output.outputFileName = "revanced-manager-${suffix}.apk"
}
}
}
Expand Down

0 comments on commit 1974659

Please sign in to comment.