forked from geode-sdk/android-launcher
add google play support (#82)
This commit is contained in:
1 parent
2016aa4e90
commit
0dba4f0606
4 files changed
+95
-9
No files matched your search
@@ -12,9 +12,15 @@ jobs:
|
|||||||
config:
|
config:
|
||||||
- name: Release
|
- name: Release
|
||||||
lower: release
|
lower: release
|
||||||
|
flavor: standard
|
||||||
|
|
||||||
- name: Debug
|
- name: Debug
|
||||||
lower: debug
|
lower: debug
|
||||||
|
flavor: standard
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
lower: release
|
||||||
|
flavor: googlePlay
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -34,9 +40,19 @@ jobs:
|
|||||||
- name: Fix gradle permissions
|
- name: Fix gradle permissions
|
||||||
run: chmod +x ./gradlew
|
run: chmod +x ./gradlew
|
||||||
|
|
||||||
- name: Build project
|
- name: Build project (standard)
|
||||||
|
if: ${{ matrix.config.flavor == 'standard' }}
|
||||||
run: |
|
run: |
|
||||||
./gradlew app:assemble${{ matrix.config.name }} \
|
./gradlew app:assembleStandard${{ matrix.config.name }} \
|
||||||
|
-Pandroid.injected.signing.store.file="$HOME/release.keystore" \
|
||||||
|
-Pandroid.injected.signing.store.password="${{secrets.KEYSTORE_PASSWORD}}" \
|
||||||
|
-Pandroid.injected.signing.key.alias="${{secrets.KEY_ALIAS}}" \
|
||||||
|
-Pandroid.injected.signing.key.password="${{secrets.KEY_PASSWORD}}"
|
||||||
|
|
||||||
|
- name: Build project (Google Play)
|
||||||
|
if: ${{ matrix.config.flavor == 'googlePlay' }}
|
||||||
|
run: |
|
||||||
|
./gradlew app:bundleGooglePlayRelease -PdisableAbiSplits \
|
||||||
-Pandroid.injected.signing.store.file="$HOME/release.keystore" \
|
-Pandroid.injected.signing.store.file="$HOME/release.keystore" \
|
||||||
-Pandroid.injected.signing.store.password="${{secrets.KEYSTORE_PASSWORD}}" \
|
-Pandroid.injected.signing.store.password="${{secrets.KEYSTORE_PASSWORD}}" \
|
||||||
-Pandroid.injected.signing.key.alias="${{secrets.KEY_ALIAS}}" \
|
-Pandroid.injected.signing.key.alias="${{secrets.KEY_ALIAS}}" \
|
||||||
@@ -44,35 +60,57 @@ jobs:
|
|||||||
|
|
||||||
- name: Rename universal apk
|
- name: Rename universal apk
|
||||||
id: rename_apk_universal
|
id: rename_apk_universal
|
||||||
|
if: ${{ matrix.config.flavor == 'standard' }}
|
||||||
run: |
|
run: |
|
||||||
SHORT_SHA=${GITHUB_SHA::7}
|
SHORT_SHA=${GITHUB_SHA::7}
|
||||||
APK_PATH=${{github.workspace}}/app/build/outputs/apk/${{ matrix.config.lower }}/app-universal-${{ matrix.config.lower }}.apk
|
APK_PATH=${{github.workspace}}/app/build/outputs/apk/standard/${{ matrix.config.lower }}/app-standard-universal-${{ matrix.config.lower }}.apk
|
||||||
OUT_PATH=${{github.workspace}}/geode-launcher-${{ matrix.config.lower }}-$SHORT_SHA.apk
|
OUT_PATH=${{github.workspace}}/geode-launcher-${{ matrix.config.lower }}-$SHORT_SHA.apk
|
||||||
mv $APK_PATH $OUT_PATH
|
mv $APK_PATH $OUT_PATH
|
||||||
echo "path=$OUT_PATH" >> $GITHUB_OUTPUT
|
echo "path=$OUT_PATH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Rename apk
|
- name: Rename apk
|
||||||
id: rename_apk
|
id: rename_apk
|
||||||
|
if: ${{ matrix.config.flavor == 'standard' }}
|
||||||
run: |
|
run: |
|
||||||
SHORT_SHA=${GITHUB_SHA::7}
|
SHORT_SHA=${GITHUB_SHA::7}
|
||||||
APK_PATH=${{github.workspace}}/app/build/outputs/apk/${{ matrix.config.lower }}/app-armeabi-v7a-${{ matrix.config.lower }}.apk
|
APK_PATH=${{github.workspace}}/app/build/outputs/apk/standard/${{ matrix.config.lower }}/app-standard-armeabi-v7a-${{ matrix.config.lower }}.apk
|
||||||
OUT_PATH=${{github.workspace}}/geode-launcher-${{ matrix.config.lower }}-android32-$SHORT_SHA.apk
|
OUT_PATH=${{github.workspace}}/geode-launcher-${{ matrix.config.lower }}-android32-$SHORT_SHA.apk
|
||||||
mv $APK_PATH $OUT_PATH
|
mv $APK_PATH $OUT_PATH
|
||||||
echo "path=$OUT_PATH" >> $GITHUB_OUTPUT
|
echo "path=$OUT_PATH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Rename mappings
|
- name: Rename mappings
|
||||||
id: rename_mappings
|
id: rename_mappings
|
||||||
if: ${{ matrix.config.lower == 'release' }}
|
if: ${{ matrix.config.flavor == 'standard' && matrix.config.lower == 'release' }}
|
||||||
run: |
|
run: |
|
||||||
SHORT_SHA=${GITHUB_SHA::7}
|
SHORT_SHA=${GITHUB_SHA::7}
|
||||||
MAPPING_PATH=${{github.workspace}}/app/build/outputs/mapping/${{ matrix.config.lower }}/mapping.txt
|
MAPPING_PATH=${{github.workspace}}/app/build/outputs/mapping/standardRelease/mapping.txt
|
||||||
|
OUT_PATH=${{github.workspace}}/mapping-${{ matrix.config.lower }}-$SHORT_SHA.txt
|
||||||
|
mv $MAPPING_PATH $OUT_PATH
|
||||||
|
echo "path=$OUT_PATH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Rename AAB
|
||||||
|
id: rename_aab
|
||||||
|
if: ${{ matrix.config.flavor == 'googlePlay' }}
|
||||||
|
run: |
|
||||||
|
SHORT_SHA=${GITHUB_SHA::7}
|
||||||
|
AAB_PATH=${{github.workspace}}/app/build/outputs/bundle/googlePlayRelease/app-googlePlay-release.aab
|
||||||
|
OUT_PATH=${{github.workspace}}/geode-launcher-${{ matrix.config.lower }}-$SHORT_SHA.aab
|
||||||
|
mv $AAB_PATH $OUT_PATH
|
||||||
|
echo "path=$OUT_PATH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Rename AAB mappings
|
||||||
|
id: rename_aab_mappings
|
||||||
|
if: ${{ matrix.config.flavor == 'googlePlay' }}
|
||||||
|
run: |
|
||||||
|
SHORT_SHA=${GITHUB_SHA::7}
|
||||||
|
MAPPING_PATH=${{github.workspace}}/app/build/outputs/mapping/googlePlayRelease/mapping.txt
|
||||||
OUT_PATH=${{github.workspace}}/mapping-${{ matrix.config.lower }}-$SHORT_SHA.txt
|
OUT_PATH=${{github.workspace}}/mapping-${{ matrix.config.lower }}-$SHORT_SHA.txt
|
||||||
mv $MAPPING_PATH $OUT_PATH
|
mv $MAPPING_PATH $OUT_PATH
|
||||||
echo "path=$OUT_PATH" >> $GITHUB_OUTPUT
|
echo "path=$OUT_PATH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Upload release build
|
- name: Upload release build
|
||||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||||
if: ${{ matrix.config.lower == 'release' }}
|
if: ${{ matrix.config.flavor == 'standard' && matrix.config.lower == 'release' }}
|
||||||
with:
|
with:
|
||||||
name: geode-launcher-${{ matrix.config.lower }}
|
name: geode-launcher-${{ matrix.config.lower }}
|
||||||
path: |
|
path: |
|
||||||
@@ -82,9 +120,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload debug build
|
- name: Upload debug build
|
||||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||||
if: ${{ matrix.config.lower == 'debug' }}
|
if: ${{ matrix.config.flavor == 'standard' && matrix.config.lower == 'debug' }}
|
||||||
with:
|
with:
|
||||||
name: geode-launcher-${{ matrix.config.lower }}
|
name: geode-launcher-${{ matrix.config.lower }}
|
||||||
path: |
|
path: |
|
||||||
${{ steps.rename_apk_universal.outputs.path }}
|
${{ steps.rename_apk_universal.outputs.path }}
|
||||||
${{ steps.rename_apk.outputs.path }}
|
${{ steps.rename_apk.outputs.path }}
|
||||||
|
|
||||||
|
- name: Upload Google Play build
|
||||||
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||||
|
if: ${{ matrix.config.flavor == 'googlePlay' }}
|
||||||
|
with:
|
||||||
|
name: geode-launcher-google-play
|
||||||
|
path: |
|
||||||
|
${{ steps.rename_aab.outputs.path }}
|
||||||
|
${{ steps.rename_aab_mappings.outputs.path }}
|
||||||
+16
-1
@@ -39,7 +39,7 @@ android {
|
|||||||
|
|
||||||
splits {
|
splits {
|
||||||
abi {
|
abi {
|
||||||
isEnable = true
|
isEnable = !project.hasProperty("disableAbiSplits")
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
//noinspection ChromeOsAbiSupport. i'm sorry!
|
//noinspection ChromeOsAbiSupport. i'm sorry!
|
||||||
@@ -49,6 +49,21 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flavorDimensions += "distribution"
|
||||||
|
|
||||||
|
productFlavors {
|
||||||
|
create("standard") {
|
||||||
|
dimension = "distribution"
|
||||||
|
isDefault = true
|
||||||
|
buildConfigField("boolean", "GOOGLE_PLAY_BUILD", "false")
|
||||||
|
}
|
||||||
|
|
||||||
|
create("googlePlay") {
|
||||||
|
dimension = "distribution"
|
||||||
|
buildConfigField("boolean", "GOOGLE_PLAY_BUILD", "true")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
isMinifyEnabled = true
|
isMinifyEnabled = true
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.REQUEST_INSTALL_PACKAGES"
|
||||||
|
tools:node="remove" />
|
||||||
|
|
||||||
|
</manifest>
|
||||||
@@ -331,6 +331,11 @@ class ReleaseManager private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun getLatestLauncherUpdate(): DownloadableLauncherRelease? {
|
private suspend fun getLatestLauncherUpdate(): DownloadableLauncherRelease? {
|
||||||
|
if (BuildConfig.GOOGLE_PLAY_BUILD) {
|
||||||
|
// don't check for updates on Google Play builds
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
releaseRepository.getLatestLauncherRelease()
|
releaseRepository.getLatestLauncherRelease()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -340,6 +345,8 @@ class ReleaseManager private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun checkLauncherUpdate() {
|
suspend fun checkLauncherUpdate() {
|
||||||
|
if (BuildConfig.GOOGLE_PLAY_BUILD) return
|
||||||
|
|
||||||
val launcherRelease = getLatestLauncherUpdate() ?: return
|
val launcherRelease = getLatestLauncherUpdate() ?: return
|
||||||
|
|
||||||
// unconditionally track it, we're not using it for checks and it might be good to have
|
// unconditionally track it, we're not using it for checks and it might be good to have
|
||||||
@@ -356,6 +363,8 @@ class ReleaseManager private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun checkCachedLauncherUpdate() {
|
fun checkCachedLauncherUpdate() {
|
||||||
|
if (BuildConfig.GOOGLE_PLAY_BUILD) return
|
||||||
|
|
||||||
val lastUpdate = PreferenceUtils.get(applicationContext)
|
val lastUpdate = PreferenceUtils.get(applicationContext)
|
||||||
.getString(PreferenceUtils.Key.LAST_LAUNCHER_UPDATE) ?: return
|
.getString(PreferenceUtils.Key.LAST_LAUNCHER_UPDATE) ?: return
|
||||||
|
|
||||||
@@ -365,6 +374,12 @@ class ReleaseManager private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun downloadLatestLauncherUpdate(): Result<File> {
|
suspend fun downloadLatestLauncherUpdate(): Result<File> {
|
||||||
|
if (BuildConfig.GOOGLE_PLAY_BUILD) {
|
||||||
|
return Result.failure(UnsupportedOperationException(
|
||||||
|
"Launcher updates are not supported on Google Play builds"
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
val update = _availableLauncherUpdateDetails.value
|
val update = _availableLauncherUpdateDetails.value
|
||||||
?: getLatestLauncherUpdate()
|
?: getLatestLauncherUpdate()
|
||||||
?: return Result.failure(FileNotFoundException())
|
?: return Result.failure(FileNotFoundException())
|
||||||
|
|||||||
Reference in new issue
Block a user