Use a new way to sign apk
This commit is contained in:
parent
d4799ab6f2
commit
5af61ff97b
3 changed files with 26 additions and 12 deletions
22
.github/workflows/android_ci.yml
vendored
22
.github/workflows/android_ci.yml
vendored
|
|
@ -25,20 +25,20 @@ jobs:
|
||||||
- name: Grant execute permission for gradlew
|
- name: Grant execute permission for gradlew
|
||||||
run: chmod +x gradlew
|
run: chmod +x gradlew
|
||||||
|
|
||||||
|
- name: Write sign info
|
||||||
|
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'Super12138/ToDo'
|
||||||
|
run: |
|
||||||
|
if [ ! -z "${{ secrets.SIGNING_KEY }}" ]; then
|
||||||
|
echo releaseStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> gradle.properties
|
||||||
|
echo releaseKeyAlias='${{ secrets.ALIAS }}' >> gradle.properties
|
||||||
|
echo releaseKeyPassword='${{ secrets.KEY_PASSWORD }}' >> gradle.properties
|
||||||
|
echo releaseStoreFile='${{ github.workspace }}/key.jks' >> gradle.properties
|
||||||
|
echo ${{ secrets.SIGNING_KEY }} | base64 --decode > ${{ github.workspace }}/key.jks
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew assembleRelease
|
run: ./gradlew assembleRelease
|
||||||
|
|
||||||
- uses: ilharp/sign-android-release@nightly
|
|
||||||
name: Sign APK
|
|
||||||
id: sign_app
|
|
||||||
with:
|
|
||||||
releaseDir: app/build/outputs/apk/release
|
|
||||||
signingKey: ${{ secrets.ANDROID_SIGNING_KEY }}
|
|
||||||
keyAlias: ${{ secrets.ANDROID_KEY_ALIAS }}
|
|
||||||
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
|
||||||
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
|
||||||
buildToolsVersion: 33.0.0
|
|
||||||
|
|
||||||
- name: Upload APK
|
- name: Upload APK
|
||||||
uses: actions/upload-artifact@v4.3.1
|
uses: actions/upload-artifact@v4.3.1
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,18 @@ android {
|
||||||
namespace = "cn.super12138.todo"
|
namespace = "cn.super12138.todo"
|
||||||
compileSdk = 34
|
compileSdk = 34
|
||||||
|
|
||||||
|
// 获取 Release 签名
|
||||||
|
val releaseSigning = if (project.hasProperty("releaseStoreFile")) {
|
||||||
|
signingConfigs.create("release") {
|
||||||
|
storeFile = File(project.properties["releaseStoreFile"] as String)
|
||||||
|
storePassword = project.properties["releaseStorePassword"] as String
|
||||||
|
keyAlias = project.properties["releaseKeyAlias"] as String
|
||||||
|
keyPassword = project.properties["releaseKeyPassword"] as String
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
signingConfigs.getByName("debug")
|
||||||
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "cn.super12138.todo"
|
applicationId = "cn.super12138.todo"
|
||||||
minSdk = 24
|
minSdk = 24
|
||||||
|
|
@ -29,6 +41,7 @@ android {
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
signingConfig = releaseSigning
|
||||||
isMinifyEnabled = true
|
isMinifyEnabled = true
|
||||||
isShrinkResources = true
|
isShrinkResources = true
|
||||||
proguardFiles(
|
proguardFiles(
|
||||||
|
|
|
||||||
|
|
@ -21,3 +21,4 @@ kotlin.code.style=official
|
||||||
# resources declared in the library itself and none from the library's dependencies,
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
# thereby reducing the size of the R class for that library
|
# thereby reducing the size of the R class for that library
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue