Skip to content

Commit

Permalink
Add build apk workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ismartcoding committed Dec 5, 2023
1 parent 53c3258 commit cd10c54
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 24 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/generate-apk-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Generated APK

on:
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set Up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
cache: 'gradle'

- name: Change wrapper permissions
run: chmod +x ./gradlew

# Create APK Release
- name: Build apk
run: |
ANDROID_STORE_PASSWORD=${{ secrets.ANDROID_STORE_PASSWORD }}
ANDROID_KEY_PASSWORD=${{ secrets.ANDROID_KEY_PASSWORD }}
bash build-apk.sh
# Upload Artifact Build
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: plain-app
path: /app/build/outputs/apk/free/release/app/
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ build/
# Local configuration file (sdk path, etc)
local.properties
keystore.properties
release.jks
# release.jks

# Proguard folder generated by Eclipse
proguard/
Expand Down Expand Up @@ -80,4 +80,4 @@ lint/tmp/
*.hprof

.DS_Store
/app/release/output-metadata.json
output-metadata.json
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ android {
debugSymbolLevel = "SYMBOL_TABLE"
}
configure<CrashlyticsExtension> {
mappingFileUploadEnabled = true
mappingFileUploadEnabled = false
}
// setProguardFiles(listOf(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"))
}
Expand Down
20 changes: 0 additions & 20 deletions app/free/release/output-metadata.json

This file was deleted.

Binary file added app/release.jks
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ class NotificationListenerService : NotificationListenerService() {

private fun isValidNotification(statusBarNotification: StatusBarNotification): Boolean {
val notification = statusBarNotification.notification
if (notification.flags and Notification.FLAG_FOREGROUND_SERVICE != 0 || notification.flags and Notification.FLAG_ONGOING_EVENT != 0 || notification.flags and Notification.FLAG_LOCAL_ONLY != 0 || notification.flags and NotificationCompat.FLAG_GROUP_SUMMARY != 0 //The notification that groups other notifications
if (notification.flags and Notification.FLAG_FOREGROUND_SERVICE != 0
|| notification.flags and Notification.FLAG_ONGOING_EVENT != 0
|| notification.flags and Notification.FLAG_LOCAL_ONLY != 0
|| notification.flags and NotificationCompat.FLAG_GROUP_SUMMARY != 0 //The notification that groups other notifications
) {
//This is not a notification we want!
return false
Expand Down
33 changes: 33 additions & 0 deletions build-apk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

function err_and_exit()
{
echo "$1" >&2
exit 1
}

function getVersionName()
{
echo $(grep versionName ./app/build.gradle.kts | awk -F '"' '{print $2}')
}

cat > ./keystore.properties <<EOF
storePassword=$ANDROID_STORE_PASSWORD
keyPassword=$ANDROID_KEY_PASSWORD
keyAlias=plain
storeFile=release.jks
EOF

cat > ./local.properties <<EOF
sdk.dir=/Users/$USER/Library/Android/sdk
EOF

echo "Build PlainApp-$(getVersionName).apk..."

./gradlew assembleFreeRelease || err_and_exit "build failed"

echo "Copying apk file..."

BUILD_FILE="PlainApp-$(getVersionName).apk"

mv ./app/build/outputs/apk/free/release/app-free-release.apk ./app/build/outputs/apk/free/release/$BUILD_FILE

0 comments on commit cd10c54

Please sign in to comment.