Skip to content

Commit 260781e

Browse files
committed
ADD: android sign config
1 parent ba7ebf4 commit 260781e

File tree

7 files changed

+105
-1
lines changed

7 files changed

+105
-1
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Android Release CI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up JDK 17
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: '17'
23+
distribution: 'temurin'
24+
cache: gradle
25+
26+
- name: Decode Keystore
27+
env:
28+
SIGNING_KEY_STORE_BASE64: ${{ secrets.SIGNING_KEY_STORE_BASE64 }}
29+
run: |
30+
echo $SIGNING_KEY_STORE_BASE64 | base64 --decode > ${{ github.workspace }}/release.keystore
31+
32+
- name: Grant execute permission for gradlew
33+
run: chmod +x gradlew
34+
35+
- name: Build with Gradle
36+
env:
37+
SIGNING_KEY_STORE_PATH: ${{ github.workspace }}/release.keystore
38+
SIGNING_KEY_STORE_PASSWORD: ${{ secrets.SIGNING_KEY_STORE_PASSWORD }}
39+
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
40+
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
41+
run: ./gradlew :composeApp:assembleRelease
42+
43+
- name: Upload Android Apk to PGYER
44+
uses: PGYER/[email protected]
45+
with:
46+
_api_key: ${{ secrets.PGYER_API_TOKEN }}
47+
appFilePath: composeApp/build/outputs/apk/release/composeApp-release.apk
48+
49+
- name: Create Release and Upload APK
50+
uses: softprops/action-gh-release@v2
51+
with:
52+
files: composeApp/build/outputs/apk/release/composeApp-release.apk
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ captures
1616
!*.xcodeproj/project.xcworkspace/
1717
!*.xcworkspace/contents.xcworkspacedata
1818
**/xcshareddata/WorkspaceSettings.xcsettings
19+
**/*.jks

composeApp/build.gradle.kts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ kotlin {
126126
}
127127

128128
android {
129-
namespace = "com.tencent.compose"
129+
namespace = "com.jiang.nowinkotlin"
130130
compileSdk = libs.versions.android.compileSdk.get().toInt()
131131

132132
defaultConfig {
@@ -141,9 +141,21 @@ android {
141141
excludes += "/META-INF/{AL2.0,LGPL2.1}"
142142
}
143143
}
144+
signingConfigs{
145+
create("release") {
146+
val keyStoreFile = file(System.getenv("SIGNING_KEY_STORE_PATH") ?: "${project.rootDir}/nowinkotlin.jks")
147+
if (keyStoreFile.exists()) {
148+
storeFile = keyStoreFile
149+
storePassword = System.getenv("SIGNING_KEY_STORE_PASSWORD")
150+
keyAlias = System.getenv("SIGNING_KEY_ALIAS")
151+
keyPassword = System.getenv("SIGNING_KEY_PASSWORD")
152+
}
153+
}
154+
}
144155
buildTypes {
145156
getByName("release") {
146157
isMinifyEnabled = false
158+
signingConfig = signingConfigs.getByName("release")
147159
}
148160
}
149161
compileOptions {
7.84 KB
Binary file not shown.
7.77 KB
Binary file not shown.
15.9 MB
Binary file not shown.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"version": 3,
3+
"artifactType": {
4+
"type": "APK",
5+
"kind": "Directory"
6+
},
7+
"applicationId": "com.jiang.nowinkotlin",
8+
"variantName": "release",
9+
"elements": [
10+
{
11+
"type": "SINGLE",
12+
"filters": [],
13+
"attributes": [],
14+
"versionCode": 1,
15+
"versionName": "1.0",
16+
"outputFile": "composeApp-release.apk"
17+
}
18+
],
19+
"elementType": "File",
20+
"baselineProfiles": [
21+
{
22+
"minApi": 28,
23+
"maxApi": 30,
24+
"baselineProfiles": [
25+
"baselineProfiles/1/composeApp-release.dm"
26+
]
27+
},
28+
{
29+
"minApi": 31,
30+
"maxApi": 2147483647,
31+
"baselineProfiles": [
32+
"baselineProfiles/0/composeApp-release.dm"
33+
]
34+
}
35+
],
36+
"minSdkVersionForDexing": 24
37+
}

0 commit comments

Comments
 (0)