Files
jellyfin-android/buildSrc/src/main/kotlin/SigningHelper.kt
T
57be96f1a4 ci(publish): add initial publish app GH workflow (#330)
* remove azure pipeline in favor of GH workflow

* add GH workflow for publishing

Co-authored-by: Niels van Velzen <nielsvanvelzen@users.noreply.github.com>
Co-authored-by: Maxr1998 <max.rumpf1998@gmail.com>

* apply changes from code review

Co-authored-by: Niels van Velzen <nielsvanvelzen@users.noreply.github.com>

* remove environment from publish workflow

Co-authored-by: Niels van Velzen <nielsvanvelzen@users.noreply.github.com>
Co-authored-by: Maxr1998 <max.rumpf1998@gmail.com>
2021-05-21 19:56:45 +02:00

50 lines
1.2 KiB
Kotlin

import org.gradle.api.Project
import java.io.File
import java.util.*
object SigningHelper {
fun loadSigningConfig(project: Project): Config? {
val serializedKeystore = System.getenv("KEYSTORE") ?: return null
val storeFile = try {
project.file("/tmp/keystore.jks").apply {
writeBytes(Base64.getDecoder().decode(serializedKeystore))
}
} catch (e: RuntimeException) {
return null
}
val storePassword = System.getenv("KEYSTORE_PASSWORD") ?: return null
val keyAlias = System.getenv("KEY_ALIAS") ?: return null
val keyPassword = System.getenv("KEY_PASSWORD") ?: return null
return Config(
storeFile,
storePassword,
keyAlias,
keyPassword
)
}
data class Config(
/**
* Store file used when signing.
*/
val storeFile: File,
/**
* Store password used when signing.
*/
val storePassword: String,
/**
* Key alias used when signing.
*/
val keyAlias: String,
/**
* Key password used when signing.
*/
val keyPassword: String
)
}