Skip to content

Commit

Permalink
android app: add release stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni500github committed Jan 4, 2025
1 parent 520d76b commit d7f1c53
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
39 changes: 38 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,38 @@ jobs:
with:
name: customfetch-gui-deb-pkg
path: /tmp/customfetch-0.10.2.orig/customfetch-gui_amd64.deb

build-android-app:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x android/gradlew

- name: Build with Gradle
run: make distclean && make android_app DEBUG=0

- name: Check files
run: tree android/app/build/outputs/apk

- name: Upload to github artifacts
uses: actions/upload-artifact@v4
with:
name: customfetch-android-app
path: android/app/build/outputs/apk/release/app-release.apk

release:
name: Create GitHub Release
needs: [build-tar, build-gui-tar, build-deb-gui, build-deb, get-version]
needs: [build-tar, build-gui-tar, build-deb-gui, build-deb, build-android-app, get-version]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -215,3 +243,12 @@ jobs:
asset_path: customfetch-gui-deb-pkg/customfetch-gui_amd64.deb
asset_name: customfetch-gui_${{ needs.get-version.outputs.version }}_amd64.deb
asset_content_type: application/vnd.debian.binary-package

- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.release-url }}
asset_path: customfetch-android-app/app-release.apk
asset_name: customfetch-android-app-${{ needs.get-version.outputs.version }}.apk
asset_content_type: application/vnd.android.package-archive
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ scripts/test*
*.out
*.app
.cache
signing.properties
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ $(TARGET): fmt toml $(OBJ)
cd $(BUILDDIR)/ && ln -sf $(TARGET) cufetch

android_app:
./android/gradlew build --project-dir=./android
ifeq ($(DEBUG), 1)
./android/gradlew assembleDebug --project-dir=./android
else
./android/gradlew assembleRelease --project-dir=./android
endif
@if [ $$? -eq 0 ]; then\
echo "APK build successfully. Get it in $(CURDIR)/android/app/build/outputs/apk path and choose which to install (debug/release)";\
fi
Expand Down
18 changes: 18 additions & 0 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.Properties

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
Expand All @@ -23,15 +25,31 @@ android {
}
}

signingConfigs {
create("release") {
val properties = Properties().apply {
load(rootProject.file("signing.properties").reader())
}
storeFile = File(properties.getProperty("storeFilePath"))
storePassword = properties.getProperty("storePassword")
keyPassword = properties.getProperty("keyPassword")
keyAlias = properties.getProperty("keyAlias")
}
}

buildTypes {
release {
getByName("release") {
signingConfig = signingConfigs.getByName("release")
}
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
Expand Down

0 comments on commit d7f1c53

Please sign in to comment.