diff --git a/.github/workflows/android_cd.yml b/.github/workflows/android_cd.yml index 6cd02cf..2cc5065 100644 --- a/.github/workflows/android_cd.yml +++ b/.github/workflows/android_cd.yml @@ -28,7 +28,7 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: set up JDK 17 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: java-version: 17 @@ -43,7 +43,7 @@ jobs: - name: Decode google-services.json env: FIREBASE_SECRET: ${{ secrets.FIREBASE_SECRET }} - run: echo $FIREBASE_SECRET > app/google-services.json + run: echo "$FIREBASE_SECRET" > app/google-services.json - name: Access local properties env: @@ -54,22 +54,39 @@ jobs: GOOGLE_ADS_API_ID: ${{ secrets.GOOGLE_ADS_API_ID }} GOOGLE_ADS_API_ID_MANIFEST: ${{ secrets.GOOGLE_ADS_API_ID }} run: | - echo "dev.base.url=\"$BASE_URL\"" >> local.properties + echo "dev.base.url=\"$HFM_BASE_URL\"" >> local.properties echo "kakao.native.app.key.manifest=\"$KAKAO_NATIVE_APP_KEY_MANIFEST\"" >> local.properties echo "kakao.native.app.key=\"$KAKAO_NATIVE_APP_KEY\"" >> local.properties echo "amplitude.dev.api.key=\"$AMPLITUDE_API_KEY\"" >> local.properties - echo "google.ads.api.id=\"GOOGLE_ADS_API_ID\"" >> local.properties - echo "google.ads.api.id.manifest=\"GOOGLE_ADS_API_ID_MANIFEST\"" >> local.properties + echo "google.ads.api.id=\"$GOOGLE_ADS_API_ID\"" >> local.properties + echo "google.ads.api.id.manifest=\"$GOOGLE_ADS_API_ID_MANIFEST\"" >> local.properties - - name: Build Release APK + - name: Decode Keystore + run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > app/date_road.keystore + + - name: Export signing environment run: | - ./gradlew :app:assembleRelease + echo "STORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}" >> $GITHUB_ENV + echo "KEY_ALIAS=${{ secrets.KEY_ALIAS }}" >> $GITHUB_ENV + echo "KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}" >> $GITHUB_ENV + + - name: Build Signed Release APK + run: ./gradlew :app:assembleRelease + + - name: Upload Signed APK + uses: actions/upload-artifact@v4 + with: + name: release-apk + path: ./app/build/outputs/apk/release/app-release.apk + + - name: Build Signed Release AAB + run: ./gradlew :app:bundleRelease - - name: Upload Release APK + - name: Upload Signed AAB uses: actions/upload-artifact@v4 with: - name: release - path: ./app/build/outputs/apk/release/app-release-unsigned.apk + name: release-aab + path: ./app/build/outputs/bundle/release/app-release.aab - name: Discord Notify - Success if: ${{ success() }} @@ -81,7 +98,8 @@ jobs: username: DATEROAD-ANDROID ๐Ÿซ content: | Release Test๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค! - [โ‡๏ธ APK๋ฅผ ๋‹ค์šด๋กœ๋“œํ•ด ๋ณด์„ธ์š”! โ‡๏ธ](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + [โ‡๏ธ APK ๋‹ค์šด๋กœ๋“œ](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + [๐Ÿ“ฆ AAB ๋‹ค์šด๋กœ๋“œ](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - name: Discord Notify - Failure if: ${{ failure() }} diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 75eca75..b2ae770 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -16,6 +16,8 @@ val properties = Properties().apply { } android { + val keystoreFile = file("date_road.keystore") + namespace = "org.sopt.teamdateroad" compileSdk = libs.versions.compileSdk.get().toInt() @@ -37,6 +39,16 @@ android { manifestPlaceholders["KAKAO_NATIVE_APP_KEY_MANIFEST"] = properties["kakao.native.app.key.manifest"] as String manifestPlaceholders["GOOGLE_ADS_API_ID_MANIFEST"] = properties["google.ads.api.id.manifest"] as String } + signingConfigs { + if (keystoreFile.exists()) { + create("release") { + storeFile = keystoreFile + storePassword = System.getenv("STORE_PASSWORD") + keyAlias = System.getenv("KEY_ALIAS") + keyPassword = System.getenv("KEY_PASSWORD") + } + } + } buildTypes { debug { @@ -47,6 +59,9 @@ android { } release { + if (keystoreFile.exists()) { + signingConfig = signingConfigs.getByName("release") + } isMinifyEnabled = true isShrinkResources = true buildConfigField("String", "BASE_URL", properties["prod.base.url"].toString()) @@ -58,6 +73,7 @@ android { ) } } + compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8