Skip to content

Commit 1f90bdb

Browse files
committed
android app: add release build stuff
1 parent 520d76b commit 1f90bdb

4 files changed

Lines changed: 62 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,38 @@ jobs:
147147
with:
148148
name: customfetch-gui-deb-pkg
149149
path: /tmp/customfetch-0.10.2.orig/customfetch-gui_amd64.deb
150+
151+
build-android-app:
152+
runs-on: ubuntu-latest
153+
154+
steps:
155+
- uses: actions/checkout@v4
156+
157+
- name: Set up JDK 17
158+
uses: actions/setup-java@v4
159+
with:
160+
java-version: '17'
161+
distribution: 'temurin'
162+
cache: gradle
163+
164+
- name: Grant execute permission for gradlew
165+
run: chmod +x android/gradlew
166+
167+
- name: Build with Gradle
168+
run: make distclean && make android_app DEBUG=0
169+
170+
- name: Check files
171+
run: tree android/app/build/outputs/apk
172+
173+
- name: Upload to github artifacts
174+
uses: actions/upload-artifact@v4
175+
with:
176+
name: customfetch-android-app
177+
path: android/app/build/outputs/apk/release/app-release.apk
150178

151179
release:
152180
name: Create GitHub Release
153-
needs: [build-tar, build-gui-tar, build-deb-gui, build-deb, get-version]
181+
needs: [build-tar, build-gui-tar, build-deb-gui, build-deb, build-android-app, get-version]
154182
runs-on: ubuntu-latest
155183
permissions:
156184
contents: write
@@ -215,3 +243,12 @@ jobs:
215243
asset_path: customfetch-gui-deb-pkg/customfetch-gui_amd64.deb
216244
asset_name: customfetch-gui_${{ needs.get-version.outputs.version }}_amd64.deb
217245
asset_content_type: application/vnd.debian.binary-package
246+
247+
- uses: actions/upload-release-asset@v1
248+
env:
249+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
250+
with:
251+
upload_url: ${{ needs.release.outputs.release-url }}
252+
asset_path: customfetch-android-app/app-release.apk
253+
asset_name: customfetch-android-app-${{ needs.get-version.outputs.version }}.apk
254+
asset_content_type: application/vnd.android.package-archive

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ scripts/test*
5050
*.out
5151
*.app
5252
.cache
53+
signing.properties

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ $(TARGET): fmt toml $(OBJ)
7979
cd $(BUILDDIR)/ && ln -sf $(TARGET) cufetch
8080

8181
android_app:
82-
./android/gradlew build --project-dir=./android
82+
ifeq ($(DEBUG), 1)
83+
./android/gradlew assembleDebug --project-dir=./android
84+
else
85+
./android/gradlew assembleRelease --project-dir=./android
86+
endif
8387
@if [ $$? -eq 0 ]; then\
8488
echo "APK build successfully. Get it in $(CURDIR)/android/app/build/outputs/apk path and choose which to install (debug/release)";\
8589
fi

android/app/build.gradle.kts

Lines changed: 18 additions & 0 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)
@@ -23,15 +25,31 @@ android {
2325
}
2426
}
2527

28+
signingConfigs {
29+
create("release") {
30+
val properties = Properties().apply {
31+
load(rootProject.file("signing.properties").reader())
32+
}
33+
storeFile = File(properties.getProperty("storeFilePath"))
34+
storePassword = properties.getProperty("storePassword")
35+
keyPassword = properties.getProperty("keyPassword")
36+
keyAlias = properties.getProperty("keyAlias")
37+
}
38+
}
39+
2640
buildTypes {
2741
release {
42+
getByName("release") {
43+
signingConfig = signingConfigs.getByName("release")
44+
}
2845
isMinifyEnabled = false
2946
proguardFiles(
3047
getDefaultProguardFile("proguard-android-optimize.txt"),
3148
"proguard-rules.pro"
3249
)
3350
}
3451
}
52+
3553
compileOptions {
3654
sourceCompatibility = JavaVersion.VERSION_11
3755
targetCompatibility = JavaVersion.VERSION_11

0 commit comments

Comments
 (0)