diff --git a/.github/workflows/firebase-app-distribution.yml b/.github/workflows/firebase-app-distribution.yml index 38015e14..0fa3bd4a 100644 --- a/.github/workflows/firebase-app-distribution.yml +++ b/.github/workflows/firebase-app-distribution.yml @@ -1,11 +1,15 @@ name: Firebase App Distribution on: - push: - tags: [ "v*" ] + workflow_dispatch: + inputs: + tag_name: + description: Distribution tag to build from + required: true + type: string concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ inputs.tag_name || github.ref }} cancel-in-progress: true jobs: @@ -21,6 +25,7 @@ jobs: uses: actions/checkout@v5 with: fetch-depth: 0 + ref: ${{ inputs.tag_name }} - name: Set up JDK 21 uses: actions/setup-java@v5 @@ -44,13 +49,21 @@ jobs: ${{ secrets.GOOGLE_SERVICES_JSON }} EOF + - name: Create Android release keystore + run: | + echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > ./prezel.jks + - name: Prepare version metadata run: | + DISTRIBUTION_TAG="${{ inputs.tag_name }}" + echo "DISTRIBUTION_TAG=$DISTRIBUTION_TAG" >> "$GITHUB_ENV" echo "ANDROID_VERSION_CODE=${GITHUB_RUN_NUMBER}" >> "$GITHUB_ENV" - echo "ANDROID_VERSION_NAME=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" + echo "ANDROID_VERSION_NAME=${DISTRIBUTION_TAG#v}" >> "$GITHUB_ENV" + echo "APP_APPLICATION_ID=com.team.prezel.dev" >> "$GITHUB_ENV" + echo "APP_NAME=Prezel (Internal)" >> "$GITHUB_ENV" - - name: Build Debug APK - run: ./gradlew assembleDebug --build-cache --parallel + - name: Build Release APK + run: ./gradlew assembleRelease --build-cache --parallel - name: Upload to Firebase App Distribution uses: wzieba/Firebase-Distribution-Github-Action@v1 @@ -59,17 +72,17 @@ jobs: serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} groups: ${{ vars.FIREBASE_APP_DISTRIBUTION_GROUPS }} releaseNotes: | - Tag: ${{ github.ref_name }} + Tag: ${{ env.DISTRIBUTION_TAG }} Commit: ${{ github.sha }} Actor: ${{ github.actor }} Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - file: ./Prezel/app/build/outputs/apk/debug/app-debug.apk + file: ./Prezel/app/build/outputs/apk/release/app-release.apk - name: Send Discord Notification if: always() env: DISCORD_WEBHOOK: ${{ secrets.DISTRIBUTION_DISCORD_HOOK_URL }} - STATUS_TITLE: ${{ job.status == 'success' && '✅ Firebase Debug 배포 성공' || '❌ Firebase Debug 배포 실패' }} + STATUS_TITLE: ${{ job.status == 'success' && '✅ Firebase Release 배포 성공' || '❌ Firebase Release 배포 실패' }} STATUS_COLOR: ${{ job.status == 'success' && '3066993' || '15158332' }} BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} EVENT_TIMESTAMP: ${{ github.event.head_commit.timestamp || github.event.repository.pushed_at }} @@ -84,12 +97,12 @@ jobs: "embeds": [ { "title": "$STATUS_TITLE", - "description": "Firebase Distribution Debug APK 배포가 완료되었습니다.", + "description": "Firebase Distribution Release APK 배포가 완료되었습니다.", "color": $STATUS_COLOR, "fields": [ { "name": "🏷 Tag", - "value": "${{ github.ref_name }}" + "value": "${{ env.DISTRIBUTION_TAG }}" }, { "name": "📦 Version", diff --git a/.github/workflows/version-tag-on-merge.yml b/.github/workflows/version-tag-on-merge.yml index 315cd9f4..fb595795 100644 --- a/.github/workflows/version-tag-on-merge.yml +++ b/.github/workflows/version-tag-on-merge.yml @@ -6,11 +6,12 @@ on: types: [ "closed" ] permissions: + actions: write contents: write jobs: tag-version: - if: ${{ github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' }} + if: ${{ github.event_name == 'push' || (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop') }} runs-on: ubuntu-latest steps: @@ -21,8 +22,8 @@ jobs: - name: Determine next version tag env: - PR_LABELS_JSON: ${{ toJson(github.event.pull_request.labels.*.name) }} - TARGET_SHA: ${{ github.event.pull_request.merge_commit_sha }} + PR_LABELS_JSON: ${{ github.event_name == 'pull_request' && toJson(github.event.pull_request.labels.*.name) || '[]' }} + TARGET_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.merge_commit_sha || github.sha }} run: | set -euo pipefail @@ -72,7 +73,7 @@ jobs: - name: Create version tag if: ${{ env.TAG_ALREADY_EXISTS == 'false' }} env: - TARGET_SHA: ${{ github.event.pull_request.merge_commit_sha }} + TARGET_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.merge_commit_sha || github.sha }} run: | set -euo pipefail @@ -81,3 +82,17 @@ jobs: git tag -a "$TAG_NAME" "$TARGET_SHA" -m "Release $TAG_NAME" git push origin "$TAG_NAME" + + - name: Dispatch Firebase distribution workflow + uses: actions/github-script@v8 + with: + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: "firebase-app-distribution.yml", + ref: context.ref.replace("refs/heads/", ""), + inputs: { + tag_name: process.env.TAG_NAME, + }, + }); diff --git a/Prezel/.gitignore b/Prezel/.gitignore index 327e5f4f..3374490a 100644 --- a/Prezel/.gitignore +++ b/Prezel/.gitignore @@ -12,6 +12,7 @@ /captures .externalNativeBuild .cxx -local.properties +*.jks +*.keystore .agents/ skills-lock.json diff --git a/Prezel/app/build.gradle.kts b/Prezel/app/build.gradle.kts index 6f0a4a50..ebd512a3 100644 --- a/Prezel/app/build.gradle.kts +++ b/Prezel/app/build.gradle.kts @@ -1,3 +1,5 @@ +import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties + plugins { alias(libs.plugins.prezel.android.application.compose) alias(libs.plugins.prezel.hilt) @@ -13,15 +15,35 @@ val androidVersionNameProvider = providers .gradleProperty("ANDROID_VERSION_NAME") .orElse(providers.environmentVariable("ANDROID_VERSION_NAME")) .orElse("0.1.0") +val appApplicationIdProvider = providers + .gradleProperty("APP_APPLICATION_ID") + .orElse(providers.environmentVariable("APP_APPLICATION_ID")) + .orElse("com.team.prezel") +val appNameProvider = providers + .gradleProperty("APP_NAME") + .orElse(providers.environmentVariable("APP_NAME")) + .orElse("Prezel") android { namespace = "com.team.prezel" defaultConfig { + applicationId = appApplicationIdProvider.get() versionCode = androidVersionCodeProvider.get().toInt() versionName = androidVersionNameProvider.get() } + signingConfigs { + create("release") { + val localProperties = gradleLocalProperties(rootDir, providers) + + storeFile = rootProject.file(localProperties.getProperty("signed.store.file")) + storePassword = localProperties.getProperty("signed.store.password") + keyAlias = localProperties.getProperty("signed.key.alias") + keyPassword = localProperties.getProperty("signed.key.password") + } + } + buildTypes { debug { isMinifyEnabled = false @@ -30,8 +52,10 @@ android { } release { - isMinifyEnabled = true - isShrinkResources = true + isMinifyEnabled = false + isShrinkResources = false + resValue("string", "app_name", appNameProvider.get()) + signingConfig = signingConfigs.getByName("release") proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro", @@ -61,10 +85,10 @@ dependencies { implementation(projects.featureHomeImpl) implementation(projects.featureHistoryApi) implementation(projects.featureHistoryImpl) - implementation(projects.featureFeedbackApi) - implementation(projects.featureFeedbackImpl) implementation(projects.featureMyApi) implementation(projects.featureMyImpl) + implementation(projects.featureFeedbackApi) + implementation(projects.featureFeedbackImpl) implementation(projects.featureTermsImpl) implementation(projects.featurePracticeImpl)