diff --git a/.github/workflows/checkPRToDev.yml b/.github/workflows/checkPRToDev.yml new file mode 100644 index 00000000..7bb399df --- /dev/null +++ b/.github/workflows/checkPRToDev.yml @@ -0,0 +1,31 @@ +name: Check Pull Request to dev branch + +on: + # Triggers the workflow on push or pull request events but only for the "dev" branch + pull_request: + branches: [ "dev" ] + + workflow_dispatch: + +jobs: + check_pull_request: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v1 + with: {java-version: 1.17} + - name: Build app + env: + STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} + KEY_ALIAS: ${{ secrets.KEY_ALIAS }} + KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} + run: | + ./gradlew :app:build + + - name: Check status + run: echo "Check build status" + - name: Set failed if build failed + if: failure() + run: | + echo "::error::Build failed" diff --git a/.github/workflows/sendAppToQaAfterMergeStageQa.yml b/.github/workflows/sendAppToQaAfterMergeStageQa.yml new file mode 100644 index 00000000..99b0a72d --- /dev/null +++ b/.github/workflows/sendAppToQaAfterMergeStageQa.yml @@ -0,0 +1,38 @@ +name: Build and sent to QA stageQa + +on: + # Triggers the workflow when pull request closed events but only for the "dev" branch + pull_request: + types: + - closed + branches: [ "dev" ] + + workflow_dispatch: + +jobs: + send_to_qa_stage: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v1 + with: { java-version: 1.17 } + - name: Build and send application stageQa to App Distribution + env: + STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} + KEY_ALIAS: ${{ secrets.KEY_ALIAS }} + KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} + CREDENTIAL_FILE_CONTENT: ${{ secrets.CREDENTIAL_FILE_CONTENT }} + run: | + echo "$CREDENTIAL_FILE_CONTENT" > ./app/serviceCredentialsFile.json + echo "App type: stageQa" >> ./app/src/releaseNotes.txt + echo "buildNumber=${GITHUB_RUN_NUMBER}" >> ./app/src/releaseNotes.txt + ./gradlew appDistributionToQaStageQa + + - name: Check status + run: echo "Check build status and send status" + - name: Set failed if build failed + if: failure() + run: | + echo "::error::Build or send build stageQa to App Distribution failed" diff --git a/.gitignore b/.gitignore index 87f66f51..1d73ef0f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ .externalNativeBuild .cxx local.properties +/app/serviceCredentialsFile.json diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 99764ee8..ebbba06e 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,3 +1,5 @@ +import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties + import com.google.firebase.appdistribution.gradle.firebaseAppDistribution plugins { @@ -10,7 +12,6 @@ plugins { alias(libs.plugins.firebase.crashlytics.gradle) alias(libs.plugins.gms.googleServices) alias(libs.plugins.firebase.appdistribution) - } android { @@ -26,40 +27,48 @@ android { testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } + signingConfigs { + create("release") { + + val localProperties = gradleLocalProperties(rootDir) + + val storePasswordLocal: String = + System.getenv("STORE_PASSWORD") ?: localProperties.getProperty("storePassword") + ?: "storePasswordEmpty" + val keyAliasLocal: String = + System.getenv("KEY_ALIAS") ?: localProperties.getProperty("keyAlias") + ?: "keyAliasEmpty" + val keyPasswordLocal: String = + System.getenv("KEY_PASSWORD") ?: localProperties.getProperty("keyPassword") + ?: "keyPasswordEmpty" + + storeFile = file("keyStore/cashadvisor.jks") + storePassword = storePasswordLocal + keyAlias = keyAliasLocal + keyPassword = keyPasswordLocal + } + } + buildTypes { getByName("debug") { isDebuggable = true applicationIdSuffix = ".debug" + matchingFallbacks += listOf("release") } create("qa") { initWith(getByName("release")) - isMinifyEnabled = false applicationIdSuffix = ".qa" - signingConfig = signingConfigs.getByName("debug") - - } - - firebaseAppDistribution{ - artifactType = "APK" - releaseNotesFile = "app/src/stage/qa/releaseNotes.txt" - testers = "QA" + signingConfig = signingConfigs.getByName("release") + matchingFallbacks += listOf("release") } getByName("release") { isMinifyEnabled = false proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" + getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) - - } - - firebaseAppDistribution{ - artifactType = "APK" - releaseNotesFile = "app/src/stage/qa/releaseNotes.txt" - testers = "QA" - + signingConfig = signingConfigs.getByName("release") } } @@ -88,12 +97,20 @@ android { viewBinding = true } } -task("appDistirbutionToQaStageQa") { + +firebaseAppDistribution { + artifactType = "APK" + releaseNotesFile = "app/src/releaseNotes.txt" + testers = "QA" + serviceCredentialsFile = "app/serviceCredentialsFile.json" +} + +task("appDistributionToQaStageQa") { dependsOn("assembleStageQa") dependsOn("appDistributionUploadStageQa") } -task("appDistirbutionToQaProdQa") { +task("appDistributionToQaProdQa") { dependsOn("assembleProdQa") dependsOn("appDistributionUploadProdQa") } diff --git a/app/keyStore/cashadvisor.jks b/app/keyStore/cashadvisor.jks new file mode 100644 index 00000000..e0399a83 Binary files /dev/null and b/app/keyStore/cashadvisor.jks differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9b1deb15..555dad83 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,6 +2,8 @@ + +