feat: add meitu flavor and update ci to build all flavors

This commit is contained in:
zhoubinjia committed 2026-05-06 16:38:43 +08:00
1 parent 497e46adc4
commit ef72f1b9e5
3 files changed
+35 -8

No files matched your search

+7 -4
View File
@@ -35,18 +35,21 @@ jobs:
- name: Decode Keystore
run: echo "${{ secrets.RELEASE_KEYSTORE }}" | base64 --decode > app/release.keystore
- name: Build Default Release APK
- name: Build Release APKs
run: |
./gradlew assembleDefaultRelease \
./gradlew assembleDefaultRelease assembleSamsungRelease assembleMeituRelease \
-PRELEASE_STORE_FILE=release.keystore \
-PRELEASE_STORE_PASSWORD=${{ secrets.RELEASE_STORE_PASSWORD }} \
-PRELEASE_KEY_ALIAS=${{ secrets.RELEASE_KEY_ALIAS }} \
-PRELEASE_KEY_PASSWORD=${{ secrets.RELEASE_KEY_PASSWORD }}
- name: Upload Default Release APK to GitHub Release
- name: Upload Release APKs to GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: app/build/outputs/apk/default/release/*.apk
files: |
app/build/outputs/apk/default/release/*.apk
app/build/outputs/apk/samsung/release/*.apk
app/build/outputs/apk/meitu/release/*.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+20
View File
@@ -113,6 +113,20 @@ android {
localProperties.getProperty("BUILT_IN_API_KEY", "").toBuildConfigString()
)
}
create("meitu") {
dimension = "channel"
applicationId = "com.meitu.meiyancamera"
buildConfigField(
"String",
"BUILT_IN_API_URL",
"https://token-plan-cn.xiaomimimo.com/v1".toBuildConfigString()
)
buildConfigField(
"String",
"BUILT_IN_API_KEY",
localProperties.getProperty("BUILT_IN_API_KEY", "").toBuildConfigString()
)
}
}
compileOptions {
@@ -136,6 +150,12 @@ android {
}
manifest.srcFile("src/default/AndroidManifest.xml")
}
getByName("meitu") {
java {
srcDir("src/default/java")
}
manifest.srcFile("src/default/AndroidManifest.xml")
}
}
externalNativeBuild {
@@ -56,11 +56,15 @@ object AppUpdateManager {
private val _readyApk = MutableStateFlow<File?>(null)
val readyApk: StateFlow<File?> = _readyApk.asStateFlow()
suspend fun checkForUpdate(currentVersion: String = BuildConfig.VERSION_NAME): AppUpdateRelease? =
suspend fun checkForUpdate(
currentVersion: String = BuildConfig.VERSION_NAME,
flavor: String = BuildConfig.FLAVOR
): AppUpdateRelease? =
withContext(Dispatchers.IO) {
val encodedVersion = URLEncoder.encode(currentVersion, "UTF-8")
val encodedFlavor = URLEncoder.encode(flavor, "UTF-8")
val request = Request.Builder()
.url("$VERSION_CHECK_URL?current_version=$encodedVersion")
.url("$VERSION_CHECK_URL?current_version=$encodedVersion&flavor=$encodedFlavor")
.get()
.build()
@@ -75,7 +79,7 @@ object AppUpdateManager {
PLog.d(TAG, "version: $body")
val root = JSONObject(body)
if (!root.optBoolean("has_update", false)) {
PLog.d(TAG, "No update available: current=$currentVersion")
PLog.d(TAG, "No update available: current=$currentVersion, flavor=$flavor")
return@withContext null
}
@@ -85,7 +89,7 @@ object AppUpdateManager {
val isApkAsset = assetName.endsWith(".apk", ignoreCase = true) ||
downloadUrl.substringBefore("?").endsWith(".apk", ignoreCase = true)
if (downloadUrl.isBlank() || !isApkAsset) {
PLog.w(TAG, "Update found but APK asset is missing")
PLog.w(TAG, "Update found but APK asset is missing: flavor=$flavor")
return@withContext null
}
val versionName = root.optString("latest_version")