Skip to content

Commit 2f3db5b

Browse files
author
sorrow404Null
committed
feat: add github action for building app && add dependabot for checking dependencies
1 parent d8eafe9 commit 2f3db5b

3 files changed

Lines changed: 110 additions & 3 deletions

File tree

.github/dependabot.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
target-branch: dev
5+
directory: /
6+
schedule:
7+
interval: weekly
8+
groups:
9+
github-actions:
10+
patterns:
11+
- '*'
12+
- package-ecosystem: gradle
13+
target-branch: dev
14+
directory: /
15+
schedule:
16+
interval: weekly
17+
- package-ecosystem: cargo
18+
target-branch: dev
19+
directory: /core-utils/src/main/rust/logger/
20+
schedule:
21+
interval: weekly

.github/workflows/android-ci.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Android CI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ "master" ]
7+
pull_request:
8+
branches: [ "master" ]
9+
10+
jobs:
11+
build:
12+
name: Build Android App
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up JDK 21
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '21'
25+
distribution: 'temurin'
26+
cache: gradle
27+
28+
- name: Prepare Signing Key
29+
run: |
30+
echo "${{ secrets.SIGNING_KEY }}" | base64 -d > keystore.jks
31+
32+
- name: Build Debug APK
33+
run: ./gradlew assembleDebug
34+
env:
35+
KEYSTORE_PATH: "../keystore.jks"
36+
KEYSTORE_PASS: ${{ secrets.KEY_STORE_PASSWORD }}
37+
KEY_ALIAS: ${{ secrets.ALIAS }}
38+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
39+
40+
- name: Upload Debug APK
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: MusicKit-Debug-${{ github.run_number }}
44+
path: app/build/outputs/apk/debug/*.apk
45+
46+
- name: Build Release APK
47+
run: ./gradlew assembleRelease
48+
env:
49+
KEYSTORE_PATH: "../keystore.jks"
50+
KEYSTORE_PASS: ${{ secrets.KEY_STORE_PASSWORD }}
51+
KEY_ALIAS: ${{ secrets.ALIAS }}
52+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
53+
54+
- name: Upload Release APK
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: MusicKit-Release-${{ github.run_number }}
58+
path: app/build/outputs/apk/release/*.apk

app/build.gradle.kts

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import java.util.Properties
2+
13
plugins {
24
alias(libs.plugins.android.application)
35
alias(libs.plugins.kotlin.android)
@@ -18,18 +20,40 @@ android {
1820
versionName = "1.0"
1921
}
2022

23+
val properties = Properties()
24+
runCatching { properties.load(project.rootProject.file("local.properties").inputStream()) }
25+
val keystorePath = properties.getProperty("KEYSTORE_PATH") ?: System.getenv("KEYSTORE_PATH")
26+
val keystorePwd = properties.getProperty("KEYSTORE_PASS") ?: System.getenv("KEYSTORE_PASS")
27+
val alias = properties.getProperty("KEY_ALIAS") ?: System.getenv("KEY_ALIAS")
28+
val pwd = properties.getProperty("KEY_PASSWORD") ?: System.getenv("KEY_PASSWORD")
29+
if (keystorePath != null) {
30+
signingConfigs {
31+
create("release") {
32+
storeFile = file(keystorePath)
33+
storePassword = keystorePwd
34+
keyAlias = alias
35+
keyPassword = pwd
36+
enableV3Signing = true
37+
}
38+
}
39+
40+
}
41+
2142
buildTypes {
2243
release {
2344
isMinifyEnabled = true
2445
isShrinkResources = true
2546
isDebuggable = false
26-
2747
proguardFiles(
28-
getDefaultProguardFile("proguard-android-optimize.txt"),
29-
"proguard-rules.pro"
48+
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro",
3049
)
50+
if (keystorePath != null) signingConfig = signingConfigs.getByName("release")
51+
}
52+
debug {
53+
if (keystorePath != null) signingConfig = signingConfigs.getByName("release")
3154
}
3255
}
56+
3357
compileOptions {
3458
sourceCompatibility = JavaVersion.VERSION_19
3559
targetCompatibility = JavaVersion.VERSION_19
@@ -47,6 +71,10 @@ android {
4771
}
4872
}
4973

74+
androidResources {
75+
additionalParameters += arrayOf("--allow-reserved-package-id", "--package-id", "0x64")
76+
}
77+
5078
kotlin {
5179
compilerOptions {
5280
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_19

0 commit comments

Comments
 (0)