Feature: Add workflow for push/PR checking (#1030)

* Chore: downgrade ndk version

* Fix: fix local.properties load

* Feature: add workflow for push/PR checking
This commit is contained in:
Kr328 2021-05-24 15:20:45 +08:00
parent 1a36218c80
commit 4f05ba1ac6
3 changed files with 38 additions and 7 deletions

24
.github/workflows/build-unsigned.yaml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Build Unsigned
on: [push, pull_request]
jobs:
BuildUnsigned:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 11
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Setup Cmake & Ninja
uses: lukka/get-cmake@latest
- name: Build
run: ./gradlew --no-daemon app:assembleRelease

View File

@ -48,13 +48,20 @@ android {
versionNameSuffix = ".premium" versionNameSuffix = ".premium"
if (buildFlavor == "premium") { if (buildFlavor == "premium") {
val appCenterKey = rootProject.file("local.properties").inputStream() val localFile = rootProject.file("local.properties")
.use { Properties().apply { load(it) } } if (localFile.exists()) {
.getProperty("appcenter.key", null) val appCenterKey = localFile.inputStream()
.use { Properties().apply { load(it) } }
.getProperty("appcenter.key", null)
Objects.requireNonNull(appCenterKey) if (appCenterKey != null) {
buildConfigField("String", "APP_CENTER_KEY", "\"$appCenterKey\"")
buildConfigField("String", "APP_CENTER_KEY", "\"$appCenterKey\"") } else {
buildConfigField("String", "APP_CENTER_KEY", "null")
}
} else {
buildConfigField("String", "APP_CENTER_KEY", "null")
}
} }
} }
} }

View File

@ -6,7 +6,7 @@ const val buildVersionName = "2.4.2"
const val buildMinSdkVersion = 21 const val buildMinSdkVersion = 21
const val buildTargetSdkVersion = 30 const val buildTargetSdkVersion = 30
const val buildNdkVersion = "23.0.7123448" const val buildNdkVersion = "22.1.7171670"
val Project.buildFlavor: String val Project.buildFlavor: String
get() { get() {