Rename preview build type to nightly and label FOSS builds (#3760)
Assisted-by: Claude:claude-opus-5
This commit is contained in:
@@ -11,7 +11,7 @@ class GetApplicationRelease(
|
||||
|
||||
// Check if latest version is different from current version
|
||||
val isNewVersion = isNewVersion(
|
||||
arguments.isPreview,
|
||||
arguments.isNightly,
|
||||
arguments.commitCount,
|
||||
arguments.versionName,
|
||||
release.version,
|
||||
@@ -23,15 +23,15 @@ class GetApplicationRelease(
|
||||
}
|
||||
|
||||
private fun isNewVersion(
|
||||
isPreview: Boolean,
|
||||
isNightly: Boolean,
|
||||
commitCount: Int,
|
||||
versionName: String,
|
||||
versionTag: String,
|
||||
): Boolean {
|
||||
// Removes prefixes like "r" or "v"
|
||||
val newVersion = versionTag.replace("[^\\d.]".toRegex(), "")
|
||||
return if (isPreview) {
|
||||
// Preview builds: based on releases in "mihonapp/mihon-preview" repo
|
||||
return if (isNightly) {
|
||||
// Nightly builds: based on releases in "mihonapp/mihon-preview" repo
|
||||
// tagged as something like "r1234"
|
||||
newVersion.toInt() > commitCount
|
||||
} else {
|
||||
@@ -54,7 +54,7 @@ class GetApplicationRelease(
|
||||
|
||||
data class Arguments(
|
||||
val isFoss: Boolean,
|
||||
val isPreview: Boolean,
|
||||
val isNightly: Boolean,
|
||||
val commitCount: Int,
|
||||
val versionName: String,
|
||||
val repository: String,
|
||||
|
||||
+4
-4
@@ -22,7 +22,7 @@ class GetApplicationReleaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `When has update but is preview expect new update`() = runTest {
|
||||
fun `When has update but is nightly expect new update`() = runTest {
|
||||
val release = Release(
|
||||
"r2000",
|
||||
"info",
|
||||
@@ -35,7 +35,7 @@ class GetApplicationReleaseTest {
|
||||
val result = getApplicationRelease.await(
|
||||
GetApplicationRelease.Arguments(
|
||||
isFoss = false,
|
||||
isPreview = true,
|
||||
isNightly = true,
|
||||
commitCount = 1000,
|
||||
versionName = "",
|
||||
repository = "test",
|
||||
@@ -61,7 +61,7 @@ class GetApplicationReleaseTest {
|
||||
val result = getApplicationRelease.await(
|
||||
GetApplicationRelease.Arguments(
|
||||
isFoss = false,
|
||||
isPreview = false,
|
||||
isNightly = false,
|
||||
commitCount = 0,
|
||||
versionName = "v1.0.0",
|
||||
repository = "test",
|
||||
@@ -87,7 +87,7 @@ class GetApplicationReleaseTest {
|
||||
val result = getApplicationRelease.await(
|
||||
GetApplicationRelease.Arguments(
|
||||
isFoss = false,
|
||||
isPreview = false,
|
||||
isNightly = false,
|
||||
commitCount = 0,
|
||||
versionName = "v2.0.0",
|
||||
repository = "test",
|
||||
|
||||
Reference in New Issue
Block a user