Skip to content

Commit

Permalink
feat: 使用新签名
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Nov 29, 2023
1 parent 9a73224 commit 08883da
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 17 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/Build-Apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ on:
branches:
- '**'

env:
BUGLY_TOKEN: ${{ secrets.BUGLY_TOKEN }}

jobs:
build:
if: ${{ !startsWith(github.event.head_commit.message, 'chore:') }}
Expand All @@ -32,6 +29,15 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: write secrets info
run: |
echo GKD_BUGLY_APP_ID='${{ secrets.GKD_BUGLY_APP_ID }}' >> gradle.properties
echo ${{ secrets.GKD_STORE_FILE_BASE64 }} | base64 --decode > ${{ github.workspace }}/key.jks
echo GKD_STORE_FILE='${{ github.workspace }}/key.jks' >> gradle.properties
echo GKD_STORE_PASSWORD='${{ secrets.GKD_STORE_PASSWORD }}' >> gradle.properties
echo GKD_KEY_ALIAS='${{ secrets.GKD_KEY_ALIAS }}' >> gradle.properties
echo GKD_KEY_PASSWORD='${{ secrets.GKD_KEY_PASSWORD }}' >> gradle.properties
- run: chmod 777 ./gradlew
- run: ./gradlew build

Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/Build-Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
tags:
- v*

env:
BUGLY_TOKEN: ${{ secrets.BUGLY_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -29,6 +26,15 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: write secrets info
run: |
echo GKD_BUGLY_APP_ID='${{ secrets.GKD_BUGLY_APP_ID }}' >> gradle.properties
echo ${{ secrets.GKD_STORE_FILE_BASE64 }} | base64 --decode > ${{ github.workspace }}/key.jks
echo GKD_STORE_FILE='${{ github.workspace }}/key.jks' >> gradle.properties
echo GKD_STORE_PASSWORD='${{ secrets.GKD_STORE_PASSWORD }}' >> gradle.properties
echo GKD_KEY_ALIAS='${{ secrets.GKD_KEY_ALIAS }}' >> gradle.properties
echo GKD_KEY_PASSWORD='${{ secrets.GKD_KEY_PASSWORD }}' >> gradle.properties
- run: chmod 777 ./gradlew
- run: ./gradlew build

Expand Down
21 changes: 12 additions & 9 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
)
)
buildConfigField(
"String", "BUGLY_TOKEN", jsonStringOf(System.getenv("BUGLY_TOKEN"))
"String", "GKD_BUGLY_APP_ID", jsonStringOf(project.properties["GKD_BUGLY_APP_ID"])
)

resourceConfigurations.addAll(listOf("zh", "en"))
Expand All @@ -54,18 +54,22 @@ android {
disable.add("ModifierFactoryUnreferencedReceiver")
}

signingConfigs {
create("release") {
storeFile = file("./android.jks")
storePassword = "KdMQ6pqiNSJ6Sype"
keyAlias = "key0"
keyPassword = "KdMQ6pqiNSJ6Sype"
val currentSigning = if (project.hasProperty("GKD_STORE_FILE")) {
signingConfigs.create("release") {
storeFile = file(project.properties["GKD_STORE_FILE"] as String)
storePassword = project.properties["GKD_STORE_PASSWORD"] as String
keyAlias = project.properties["GKD_KEY_ALIAS"] as String
keyPassword = project.properties["GKD_KEY_PASSWORD"] as String
}
} else {
signingConfigs.getByName("debug")
}

buildTypes {
all {
signingConfig = currentSigning
}
release {
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = true
isShrinkResources = true
setProguardFiles(
Expand All @@ -77,7 +81,6 @@ android {
}
debug {
applicationIdSuffix = ".debug"
signingConfig = signingConfigs.getByName("release")
resValue("string", "app_name", "GKD-debug")
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/li/songe/gkd/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class App : Application() {
super.onCreate()
_app = this

@Suppress("SENSELESS_COMPARISON") if (BuildConfig.BUGLY_TOKEN != null) {
@Suppress("SENSELESS_COMPARISON") if (BuildConfig.GKD_BUGLY_APP_ID != null) {
CrashReport.setDeviceModel(this, DeviceInfo.instance.model)
CrashReport.setIsDevelopmentDevice(this, BuildConfig.DEBUG)
CrashReport.initCrashReport(applicationContext,
BuildConfig.BUGLY_TOKEN,
BuildConfig.GKD_BUGLY_APP_ID,
BuildConfig.DEBUG,
CrashReport.UserStrategy(this).apply {
setCrashHandleCallback(object : CrashReport.CrashHandleCallback() {
Expand Down

0 comments on commit 08883da

Please sign in to comment.