diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..c4c8de0 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,49 @@ +name: Build and Test + +on: + pull_request: + push: + branches: [ "main" ] + +permissions: + contents: read + +env: + MAIN_MODULE: app + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "17" + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v5 + + - name: Make Gradle executable + run: chmod +x ./gradlew + + - name: Create local.properties + run: | + echo "MAPS_API_KEY=${{ secrets.MAPS_API_KEY }}" > local.properties + + - name: Ktlint Check + run: ./gradlew ktlintCheck + + - name: Build Debug + run: ./gradlew :${{ env.MAIN_MODULE }}:assembleDebug + + - name: Unit Tests + run: ./gradlew testDebugUnitTest + + - name: Cleanup + if: always() + run: rm -f local.properties diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..443ac9e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,82 @@ +name: Build & Publish Signed Release + +on: + workflow_dispatch: + push: + tags: + - "v*.*.*" + +permissions: + contents: write + +env: + MAIN_MODULE: app + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "17" + cache: gradle + + - name: Make Gradle executable + run: chmod +x ./gradlew + + - name: Create local.properties + run: | + echo "MAPS_API_KEY=${{ secrets.MAPS_API_KEY }}" > local.properties + + - name: Build Release APK + AAB + run: | + ./gradlew :${{ env.MAIN_MODULE }}:assembleRelease :${{ env.MAIN_MODULE }}:bundleRelease + + - name: Sign release APK + id: sign_apk + uses: r0adkll/sign-android-release@v1 + with: + releaseDirectory: ${{ env.MAIN_MODULE }}/build/outputs/apk/release + signingKeyBase64: ${{ secrets.SIGNING_KEYSTORE_BASE64 }} + alias: ${{ secrets.SIGNING_KEY_ALIAS }} + keyStorePassword: ${{ secrets.SIGNING_STORE_PASSWORD }} + keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} + + - name: Sign release AAB + id: sign_aab + uses: r0adkll/sign-android-release@v1 + with: + releaseDirectory: ${{ env.MAIN_MODULE }}/build/outputs/bundle/release + signingKeyBase64: ${{ secrets.SIGNING_KEYSTORE_BASE64 }} + alias: ${{ secrets.SIGNING_KEY_ALIAS }} + keyStorePassword: ${{ secrets.SIGNING_STORE_PASSWORD }} + keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} + + - name: Upload artifacts (Actions) + uses: actions/upload-artifact@v4 + with: + name: release-build + path: | + ${{ steps.sign_apk.outputs.signedReleaseFile }} + ${{ steps.sign_aab.outputs.signedReleaseFile }} + + - name: Create GitHub Release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v2 + with: + files: | + ${{ steps.sign_apk.outputs.signedReleaseFile }} + ${{ steps.sign_aab.outputs.signedReleaseFile }} + generate_release_notes: true + draft: true + prerelease: true + + - name: Cleanup secrets + if: always() + run: rm -f local.properties diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 636bec7..15d9d8e 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -7,6 +7,7 @@ plugins { id("com.mikepenz.aboutlibraries.plugin") id("com.google.gms.google-services") id("org.jlleitschuh.gradle.ktlint") + id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin") alias(libs.plugins.compose.compiler) alias(libs.plugins.hilt) alias(libs.plugins.kotlin.ksp) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index edecf27..6a6854e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -32,7 +32,7 @@ + android:value="${MAPS_API_KEY}" /> Unit, -) { - SettingsItem( - icon = Icons.Outlined.Visibility, - stringResource(R.string.color_blind_mode), - stringResource(R.string.color_blind_description), - ) { - Switch( - checked = colorBlindMode, - onCheckedChange = { updateColorBlindMode(it) }, - ) - } -} - @Composable fun ThemeModeSettingItem( themeMode: ThemeMode, diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 61df2c4..4c90806 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -129,8 +129,6 @@ Base URL Changing the URL will restart the app and stop all running services Invalid URL - More accessible shuttle icons - Colorblind mode %1$d meters Libraries used Dev options activated diff --git a/build.gradle.kts b/build.gradle.kts index 18d167f..3d2c27a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ buildscript { dependencies { classpath(libs.google.services) + classpath(libs.secrets.gradle.plugin) } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3d430a8..d978046 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -26,6 +26,7 @@ retrofit = "3.0.0" room-runtime = "2.8.4" +secrets-gradle-plugin = "2.0.1" work-runtime-ktx = "2.11.0" compose-bom = "2026.01.00" @@ -98,6 +99,7 @@ play-services-maps = { module = "com.google.android.gms:play-services-maps", ver network-reponse = { module = "com.github.haroldadmin:NetworkResponseAdapter", version.ref = "network-respose" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } +secrets-gradle-plugin = { module = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin", version.ref = "secrets-gradle-plugin" } ui = { module = "androidx.compose.ui:ui" } [plugins]