Skip to content

Commit 5dff836

Browse files
Add signed release APK workflow
1 parent 878e5de commit 5dff836

2 files changed

Lines changed: 39 additions & 7 deletions

File tree

.github/workflows/android.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,21 @@ jobs:
4848
- name: Make gradlew executable
4949
run: chmod +x gradlew
5050

51+
- name: Decode release keystore
52+
env:
53+
RELEASE_KEYSTORE_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}
54+
run: |
55+
echo "$RELEASE_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/red-release.jks"
56+
5157
- name: Build debug APK
5258
run: ./gradlew assembleDebug
5359

54-
- name: Build release APK
60+
- name: Build signed release APK
61+
env:
62+
SIGNING_STORE_FILE: ${{ runner.temp }}/red-release.jks
63+
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
64+
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
65+
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
5566
run: ./gradlew assembleRelease
5667

5768
- name: Upload debug APK artifact
@@ -60,25 +71,25 @@ jobs:
6071
name: redmagic-debug-apk
6172
path: app/build/outputs/apk/debug/*.apk
6273

63-
- name: Upload release APK artifact
74+
- name: Upload signed release APK artifact
6475
uses: actions/upload-artifact@v4
6576
with:
66-
name: redmagic-release-apk
77+
name: redmagic-signed-release-apk
6778
path: app/build/outputs/apk/release/*.apk
6879

6980
- name: Create GitHub Release from tag
7081
if: startsWith(github.ref, 'refs/tags/v')
7182
uses: softprops/action-gh-release@v2
7283
with:
7384
tag_name: ${{ github.ref_name }}
74-
name: Redmagic Control Center ${{ github.ref_name }}
85+
name: RedMagic Root Control ${{ github.ref_name }}
7586
body: |
76-
Release ${{ github.ref_name }}
87+
Signed release build for ${{ github.ref_name }}
7788
7889
Included files:
7990
- Debug APK
80-
- Release APK
91+
- Signed release APK
8192
files: |
8293
app/build/outputs/apk/debug/*.apk
8394
app/build/outputs/apk/release/*.apk
84-
generate_release_notes: true
95+
generate_release_notes: true

app/build.gradle.kts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ plugins {
33
id("org.jetbrains.kotlin.android")
44
}
55

6+
val hasSigning = listOf(
7+
"SIGNING_STORE_FILE",
8+
"SIGNING_STORE_PASSWORD",
9+
"SIGNING_KEY_ALIAS",
10+
"SIGNING_KEY_PASSWORD"
11+
).all { !System.getenv(it).isNullOrBlank() }
12+
613
android {
714
namespace = "com.elitedarkkaiser.redmagic"
815
compileSdk = 35
@@ -15,9 +22,23 @@ android {
1522
versionName = "1.0.1rc1"
1623
}
1724

25+
signingConfigs {
26+
if (hasSigning) {
27+
create("release") {
28+
storeFile = file(System.getenv("SIGNING_STORE_FILE")!!)
29+
storePassword = System.getenv("SIGNING_STORE_PASSWORD")
30+
keyAlias = System.getenv("SIGNING_KEY_ALIAS")
31+
keyPassword = System.getenv("SIGNING_KEY_PASSWORD")
32+
}
33+
}
34+
}
35+
1836
buildTypes {
1937
release {
2038
isMinifyEnabled = false
39+
if (hasSigning) {
40+
signingConfig = signingConfigs.getByName("release")
41+
}
2142
proguardFiles(
2243
getDefaultProguardFile("proguard-android-optimize.txt"),
2344
"proguard-rules.pro"

0 commit comments

Comments
 (0)