Skip to content

Commit

Permalink
artifact flavor + signed ci build + different name for non-standard-r…
Browse files Browse the repository at this point in the history
…elease
  • Loading branch information
danny8376 committed Nov 1, 2023
1 parent 0befbd9 commit bb690a6
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 10 deletions.
29 changes: 22 additions & 7 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
paths-ignore: [ "/app/src/main/res/values-*/strings.xml" ]

jobs:
build:
Expand All @@ -25,15 +26,29 @@ jobs:
- name: Build with Gradle
run: ./gradlew build

- name: Upload debug APK
- name: Upload artifact debug APK
uses: actions/upload-artifact@v3.1.3
with:
name: mset9installer-debug.apk
path: app/build/outputs/apk/debug/app-debug.apk
name: mset9installer-artifact-debug.apk
path: app/build/outputs/apk/artifact/debug/app-artifact-debug.apk

- name: Upload unsigned release APK
- name: Upload artifact unsigned release APK
uses: actions/upload-artifact@v3.1.3
with:
name: mset9installer-release.apk
path: app/build/outputs/apk/release/app-release-unsigned.apk

name: mset9installer-artifact-release-unsigned.apk
path: app/build/outputs/apk/artifact/release/app-artifact-release-unsigned.apk

- name: Sign artifact release APK
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/apk/artifact/release
signingKeyBase64: ${{ secrets.KEYSTORE }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
alias: ${{ secrets.APP_NAME_KEY }}
keyPassword: ${{ secrets.APP_NAME_KEY_PASSWORD }}

- name: Upload artifact signed release APK
uses: actions/upload-artifact@v3.1.3
with:
name: mset9installer-artifact-release.apk
path: app/build/outputs/apk/artifact/release/app-artifact-release.apk
36 changes: 35 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ android {

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

manifestPlaceholders["app_name"] = "@string/app_name"
manifestPlaceholders["app_name_default"] = "MSET9 Installer for Android"
buildConfigField("boolean", "ENABLE_DEBUG_OPTION", "false")
}

Expand All @@ -31,9 +33,42 @@ android {
applicationIdSuffix = ".debug"
versionNameSuffix = "-dbg"
isDebuggable = true
manifestPlaceholders["app_name_prefix"] = "D|"
buildConfigField("boolean", "ENABLE_DEBUG_OPTION", "true")
}
}
flavorDimensions += "artifact"
productFlavors {
create("standard") {
dimension = "artifact"
}
create("artifact") {
dimension = "artifact"
applicationIdSuffix = ".artifact"
versionNameSuffix = "-artifact"
resValue("string", "for_gradle_app_name_prefix", "A|")
manifestPlaceholders["app_name_prefix"] = "A|"
}
}

applicationVariants.all {
val variant = this
defaultConfig.manifestPlaceholders["app_name_default"]?.let { defaultAppName ->
var appNamePrefix = ""
variant.productFlavors.forEach { flavor ->
flavor.manifestPlaceholders["app_name_prefix"]?.let { prefix ->
appNamePrefix += prefix
}
}
variant.buildType.manifestPlaceholders["app_name_prefix"]?.let { prefix ->
appNamePrefix += prefix
}
if (appNamePrefix != "") {
variant.mergedFlavor.manifestPlaceholders["app_name"] = "!$appNamePrefix$defaultAppName"
}
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -48,7 +83,6 @@ android {
}

dependencies {

implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.10.0")
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label="${app_name}"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MSET9InstallerForAndroid"
Expand All @@ -16,7 +16,7 @@
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:label="${app_name}"
android:theme="@style/Theme.MSET9InstallerForAndroid">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down

0 comments on commit bb690a6

Please sign in to comment.