Skip to content

Commit

Permalink
Merge pull request #55 from psuzn/develop
Browse files Browse the repository at this point in the history
develop -> main
  • Loading branch information
psuzn authored Dec 12, 2023
2 parents 25685c9 + 15dee4f commit f16beda
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 28 deletions.
65 changes: 53 additions & 12 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ jobs:
- name: Build Project with Gradle
uses: gradle/gradle-build-action@v2

- name: Build Release AAB and apk
- name: Build Release AAB
id: build_release
run: ./gradlew androidApp:assembleRelease androidApp:bundleRelease
run: ./gradlew androidApp:bundleRelease

- name: Sign AAB
id: sign_aab
Expand All @@ -62,6 +62,31 @@ jobs:
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}

- name: Create release apk path
run: mkdir --parents androidApp/build/outputs/apks/release

- name: Build Release APK
id: build_release_apk
run: |
./gradlew androidApp:assembleRelease
## move to apks/release
mv androidApp/build/outputs/apk/release/*.apk androidApp/build/outputs/apks/release
- name: Build Foss APK
id: build_release_apk_foss
run: |
sh strip_google_services.sh
./gradlew androidApp:assembleRelease
## set appropriate nam, i.e. play-deals-*-release-unsigned.apk -> play-deals-*-release-foss-unsigned.apk
TMP_APK=$(ls androidApp/build/outputs/apk/release/*.apk)
FOSS_APK="${TMP_APK/-release-unsigned/"-release-foss-unsigned"}"
mv $TMP_APK $FOSS_APK
## move to apks/release
mv androidApp/build/outputs/apk/release/*.apk androidApp/build/outputs/apks/release
- name: Upload to google play console
uses: r0adkll/upload-google-play@v1
id: upload_to_play_console
Expand All @@ -74,22 +99,43 @@ jobs:
releaseName: ${{ github.ref_name }}
status: draft

- name: Sign APK
- name: Sign APKs
id: sign_apk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: androidApp/build/outputs/apk/release
releaseDirectory: androidApp/build/outputs/apks/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}

- name: Collect Artifacts
id: collect_artifacts
run: |
ARTIFACTS=androidApp/build/outputs/artifacts
mkdir $ARTIFACTS
TMP_APK=$(ls androidApp/build/outputs/apks/release/*-release-unsigned-signed.apk)
RELEASE_APK="${TMP_APK/-release-unsigned-signed/""}"
mv $TMP_APK $RELEASE_APK
mv $RELEASE_APK $ARTIFACTS
TMP_APK=$(ls androidApp/build/outputs/apks/release/*-release-foss-unsigned-signed.apk)
RELEASE_APK="${TMP_APK/-release-foss-unsigned-signed/"-foss"}"
mv $TMP_APK $RELEASE_APK
mv $RELEASE_APK $ARTIFACTS
TMP_BUNDLE=$(ls androidApp/build/outputs/bundle/release/*.aab)
RELEASE_BUNDLE="${TMP_BUNDLE/-release/""}"
mv $TMP_BUNDLE $RELEASE_BUNDLE
mv $RELEASE_BUNDLE $TMP_BUNDLE
echo "artifacts=$ARTIFACTS" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
with:
name: android-bundles
path: |
${{ steps.sign_aab.outputs.signedReleaseFile}}
${{ steps.sign_apk.outputs.signedReleaseFile}}
path: ${{ steps.collect_artifacts.artifacts }}

desktop_release:
name: Build desktop apps
Expand Down Expand Up @@ -138,11 +184,6 @@ jobs:
- name: Collect artifacts
run: |
mkdir artifacts
TMP_APK=$(ls downloaded/android-bundles/apk/release/*.apk)
SIGNED_APK="${TMP_APK/-release-unsigned-signed/""}"
mv $TMP_APK $SIGNED_APK
mv downloaded/android-bundles/apk/release/* artifacts/
mv downloaded/android-bundles/bundle/release/* artifacts/
mv downloaded/**/*.* artifacts/
- uses: softprops/action-gh-release@v1
Expand Down
5 changes: 3 additions & 2 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ plugins {
kotlin {
androidTarget()
sourceSets {
val androidMain by getting {
androidMain {
dependencies {
implementation(project(":shared"))
implementation("androidx.activity:activity-compose:1.8.1")
implementation("androidx.core:core-ktx:1.12.0")

implementation(platform("com.google.firebase:firebase-bom:${Versions.FIREBASE_BOM}"))
implementation(project.dependencies.platform("com.google.firebase:firebase-bom:${Versions.FIREBASE_BOM}"))
implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-messaging-ktx")
}
}
}
}


android {
compileSdk = Artifact.ANDROID_COMPILE_SDK
namespace = Artifact.APP_ID
Expand Down
12 changes: 6 additions & 6 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
object Versions {
const val KOTLIN = "1.9.10"
const val AGP = "8.1.1"
const val COMPOSE = "1.5.1"
const val KOTLIN = "1.9.20"
const val AGP = "8.2.0"
const val COMPOSE = "1.5.11"
const val SETTINGS = "1.0.0"
const val SQLDELIGHT = "2.0.0"
const val FIREBASE_BOM = "32.3.1"

const val KTOR = "2.3.5"
const val KTOR = "2.3.6"
const val KODE_IN = "7.20.2"
const val COROUTINE = "1.7.3"
const val KOTLINX_DATE_TIME = "0.4.0"
const val KOTLINX_DATE_TIME = "0.4.1"

const val JUNIT_JUPITER = "5.9.3"
const val MOCKK = "1.13.5"
const val MOCKK = "1.13.8"
const val KO_TEST = "5.5.5"
}
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Thu Dec 07 17:50:32 NPT 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
15 changes: 9 additions & 6 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ fun KotlinNativeTarget.configureFramework() {

kotlin {
jvmToolchain(17)
applyDefaultHierarchyTemplate()

androidTarget()
jvm("desktop")
ios { configureFramework() }

iosArm64() { configureFramework() }
iosX64() { configureFramework() }
iosSimulatorArm64().configureFramework()

sourceSets {
val commonMain by getting {
commonMain {
dependencies {
implementation(compose.ui)
implementation(compose.foundation)
Expand Down Expand Up @@ -64,15 +67,15 @@ kotlin {
}
}

val androidMain by getting {
androidMain {
dependencies {
implementation("io.ktor:ktor-client-android:${Versions.KTOR}")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("app.cash.sqldelight:android-driver:${Versions.SQLDELIGHT}")
implementation("androidx.startup:startup-runtime:1.1.1")
implementation("com.google.accompanist:accompanist-permissions:0.32.0")

implementation(platform("com.google.firebase:firebase-bom:${Versions.FIREBASE_BOM}"))
implementation(project.dependencies.platform("com.google.firebase:firebase-bom:${Versions.FIREBASE_BOM}"))
implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-messaging-ktx")
}
Expand All @@ -90,15 +93,15 @@ kotlin {
}
}

val iosMain by getting {
iosMain {
dependencies {
implementation("io.ktor:ktor-client-darwin:${Versions.KTOR}")
implementation("app.cash.sqldelight:native-driver:${Versions.SQLDELIGHT}")
}
}

val iosSimulatorArm64Main by getting {
dependsOn(iosMain)
dependsOn(iosMain.get())
}

val desktopMain by getting {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package me.sujanpoudel.playdeals.common.utils

import kotlin.experimental.ExperimentalNativeApi

@OptIn(ExperimentalNativeApi::class)
actual val isDebugBuild: Boolean
get() = Platform.isDebugBinary
2 changes: 1 addition & 1 deletion strip_google_services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ sed -i'.bak' -e '26,34d;' androidApp/src/androidMain/AndroidManifest.xml
rm androidApp/src/androidMain/kotlin/me/sujanpoudel/playdeals/FcmService.kt

sed -i'.bak' -e '5d;14d;18d;' shared/src/androidMain/kotlin/me/sujanpoudel/playdeals/common/pushNotification/AndroidNotificationManager.kt
sed -i'.bak' -e '75,77d;' shared/build.gradle.kts
sed -i'.bak' -e '78,80d;' shared/build.gradle.kts
sed -i'.bak' -e '16d;' build.gradle.kts

0 comments on commit f16beda

Please sign in to comment.