From 1bd844af59020103eb2e7e73ce5cd00af47d3f28 Mon Sep 17 00:00:00 2001 From: bess-cater Date: Mon, 9 Nov 2026 08:48:12 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=EB=B0=B0=ED=8F=AC=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=B4=ED=94=84=EB=9D=BC=EC=9D=B8=20=EC=B6=94=EA=B0=80=20(Te?= =?UTF-8?q?stFlight=C2=B7Play=20=EC=97=85=EB=A1=9C=EB=93=9C,=20Shorebird,?= =?UTF-8?q?=20release=20=EC=84=9C=EB=AA=85)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/actions/ios-signing/action.yml | 70 +++++ .github/workflows/app-release.yml | 114 ++++++++ .github/workflows/shorebird-patch.yml | 85 ++++++ .gitignore | 10 + AGENTS.md | 1 + apps/mobile/Gemfile | 3 + apps/mobile/Gemfile.lock | 271 ++++++++++++++++++ apps/mobile/android/app/build.gradle.kts | 24 +- .../android/app/src/main/AndroidManifest.xml | 1 + apps/mobile/fastlane/Fastfile | 32 +++ .../ios/Runner.xcodeproj/project.pbxproj | 12 +- apps/mobile/pubspec.yaml | 2 + apps/mobile/shorebird.yaml | 17 ++ docs/ci-cd.md | 62 ++++ 14 files changed, 699 insertions(+), 5 deletions(-) create mode 100644 .github/actions/ios-signing/action.yml create mode 100644 .github/workflows/app-release.yml create mode 100644 .github/workflows/shorebird-patch.yml create mode 100644 apps/mobile/Gemfile create mode 100644 apps/mobile/Gemfile.lock create mode 100644 apps/mobile/fastlane/Fastfile create mode 100644 apps/mobile/shorebird.yaml create mode 100644 docs/ci-cd.md diff --git a/.github/actions/ios-signing/action.yml b/.github/actions/ios-signing/action.yml new file mode 100644 index 0000000..9dbcc8c --- /dev/null +++ b/.github/actions/ios-signing/action.yml @@ -0,0 +1,70 @@ +# GitHub Secrets의 인증서·프로비저닝 프로파일을 임시 keychain에 설치하고 ExportOptions.plist를 만든다. +name: iOS signing +description: Install signing certificate and provisioning profile, write ExportOptions.plist + +inputs: + certificate-base64: + required: true + certificate-password: + required: true + profile-base64: + required: true + bundle-id: + required: true + team-id: + required: true + +outputs: + export-options: + description: Path to the generated ExportOptions.plist + value: ${{ steps.sign.outputs.export-options }} + +runs: + using: composite + steps: + - id: sign + shell: bash + env: + CERT: ${{ inputs.certificate-base64 }} + CERT_PASSWORD: ${{ inputs.certificate-password }} + PROFILE: ${{ inputs.profile-base64 }} + BUNDLE_ID: ${{ inputs.bundle-id }} + TEAM_ID: ${{ inputs.team-id }} + run: | + set -euo pipefail + KEYCHAIN="$RUNNER_TEMP/app-signing.keychain-db" + KEYCHAIN_PASSWORD="$(openssl rand -base64 24)" + + echo -n "$CERT" | base64 --decode > "$RUNNER_TEMP/cert.p12" + echo -n "$PROFILE" | base64 --decode > "$RUNNER_TEMP/profile.mobileprovision" + + security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN" + security set-keychain-settings -lut 21600 "$KEYCHAIN" + security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN" + security import "$RUNNER_TEMP/cert.p12" -P "$CERT_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN" + security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN" + security list-keychain -d user -s "$KEYCHAIN" + + security cms -D -i "$RUNNER_TEMP/profile.mobileprovision" > "$RUNNER_TEMP/profile.plist" + UUID="$(/usr/libexec/PlistBuddy -c 'Print UUID' "$RUNNER_TEMP/profile.plist")" + NAME="$(/usr/libexec/PlistBuddy -c 'Print Name' "$RUNNER_TEMP/profile.plist")" + mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles" + cp "$RUNNER_TEMP/profile.mobileprovision" "$HOME/Library/MobileDevice/Provisioning Profiles/$UUID.mobileprovision" + + EXPORT_OPTIONS="$RUNNER_TEMP/ExportOptions.plist" + cat > "$EXPORT_OPTIONS" < + + + + methodapp-store-connect + teamID$TEAM_ID + signingStylemanual + provisioningProfiles + + $BUNDLE_ID$NAME + + + + EOF + echo "export-options=$EXPORT_OPTIONS" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/app-release.yml b/.github/workflows/app-release.yml new file mode 100644 index 0000000..904a871 --- /dev/null +++ b/.github/workflows/app-release.yml @@ -0,0 +1,114 @@ +# develop/main merge 시 Shorebird release 빌드 → Fastlane 업로드(재빌드 X) → TestFlight / Play 내부 테스트. +# develop → dev(com.ject.highfive.dev), main → prod(com.ject.highfive). +# 스토어 출시(App Store 심사, Google Play 검토)는 prod만, 콘솔에서 수동 승인. +# PR 검사는 mobile.yml / web.yml이 맡는다. +name: App Release + +on: + push: + branches: [develop, main] + paths: + - 'apps/mobile/**' + workflow_dispatch: + +concurrency: + group: app-release-${{ github.ref }} + cancel-in-progress: false + +env: + FLAVOR: ${{ github.ref_name == 'main' && 'prod' || 'dev' }} + APP_ID: ${{ github.ref_name == 'main' && 'com.ject.highfive' || 'com.ject.highfive.dev' }} + BUILD_NUMBER: ${{ github.run_number }} + +jobs: + android: + runs-on: ubuntu-latest + defaults: + run: + working-directory: apps/mobile + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + - uses: shorebirdtech/setup-shorebird@v1 + with: + cache: true + - name: Android signing + env: + KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} + KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} + KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} + KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} + run: | + echo -n "$KEYSTORE_BASE64" | base64 --decode > android/app/upload-keystore.jks + cat > android/key.properties <= 2.0.2, < 8.0) + artifactory (3.0.17) + atomos (0.1.3) + aws-eventstream (1.4.1) + aws-partitions (1.1299.1) + aws-sdk-core (3.263.0) + aws-eventstream (~> 1, >= 1.4.1) + aws-partitions (~> 1, >= 1.992.0) + aws-sigv4 (~> 1.9) + base64 + bigdecimal + jmespath (~> 1, >= 1.6.1) + logger + rexml (~> 3.4, >= 3.4.2) + aws-sdk-kms (1.138.0) + aws-sdk-core (~> 3, >= 3.263.0) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.237.0) + aws-sdk-core (~> 3, >= 3.263.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.5) + aws-sigv4 (1.12.1) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + base64 (0.3.0) + benchmark (0.5.0) + bigdecimal (4.1.3) + cgi (0.5.2) + claide (1.1.0) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + csv (3.3.7) + declarative (0.0.20) + digest-crc (0.7.0) + rake (>= 12.0.0, < 14.0.0) + domain_name (0.7.20261007) + dotenv (2.8.1) + emoji_regex (3.2.3) + erb (6.0.7) + excon (1.6.0) + logger + faraday (2.15.1) + faraday-net_http (>= 2.0, < 3.6) + json + logger + faraday-cookie_jar (0.0.8) + faraday (>= 0.8.0) + http-cookie (>= 1.0.0) + faraday-follow_redirects (0.5.0) + faraday (>= 1, < 3) + faraday-multipart (1.2.0) + multipart-post (~> 2.0) + faraday-net_http (3.5.0) + net-http (~> 0.5) + faraday-retry (2.4.0) + faraday (~> 2.0) + fastimage (2.4.3) + fastlane (2.241.2) + CFPropertyList (>= 2.3, < 5.0.0) + abbrev (~> 0.1) + addressable (>= 2.9.0, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.197) + babosa (>= 1.0.3, < 2.0.0) + base64 (~> 0.2) + benchmark (>= 0.1.0) + bundler (>= 2.4.0, < 5.0.0) + cgi (~> 0.4) + colored (~> 1.2) + commander (~> 4.6) + csv (~> 3.3) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + erb (>= 4.0, < 7.0) + excon (>= 1.0.0, < 2.0.0) + faraday (~> 2.7) + faraday-cookie_jar (~> 0.0.8) + faraday-follow_redirects (~> 0.3) + faraday-multipart (~> 1.0) + faraday-retry (~> 2.0) + fastimage (>= 2.1.0, < 3.0.0) + fastlane-sirp (>= 1.1.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.99) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-env (>= 1.6.0, < 2.5.0) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + irb (>= 1.8) + json (< 3.0.0) + jwt (>= 2.10.3, < 4) + logger (>= 1.6, < 2.0) + mini_magick (>= 4.9.4, < 5.0.0) + multi_json (~> 1.12) + multipart-post (>= 2.0.0, < 3.0.0) + mutex_m (~> 0.3) + naturally (~> 2.2) + nkf (~> 0.2) + optparse (>= 0.1.1, < 1.0.0) + ostruct (>= 0.1.0) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 3.4.0, < 4.0.0) + security (~> 0.3) + simctl (~> 1.6.3) + terminal-notifier (>= 3.1.0, < 4.0.0) + terminal-table (~> 4) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.4.1) + xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) + fastlane-sirp (1.1.0) + gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.110.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-core (1.4.0) + addressable (~> 2.9) + faraday (~> 2.13) + faraday-follow_redirects (~> 0.3) + googleauth (~> 1.14) + mini_mime (~> 1.1) + multi_json (~> 1.11) + representable (~> 3.0) + retriable (>= 3.1, < 5.0) + google-apis-iamcredentials_v1 (0.28.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-playcustomapp_v1 (0.18.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-storage_v1 (0.70.0) + google-apis-core (>= 0.15.0, < 2.a) + google-cloud-core (1.9.1) + google-cloud-env (>= 1.0, < 3.a) + google-cloud-errors (~> 1.0) + google-cloud-env (2.4.1) + base64 (~> 0.2) + faraday (>= 1.0, < 3.a) + google-cloud-errors (1.7.1) + google-cloud-storage (1.62.1) + addressable (~> 2.8) + digest-crc (~> 0.4) + google-apis-core (>= 0.18, < 2) + google-apis-iamcredentials_v1 (~> 0.18) + google-apis-storage_v1 (>= 0.42) + google-cloud-core (~> 1.6) + googleauth (~> 1.9) + mini_mime (~> 1.0) + google-logging-utils (0.2.2) + googleauth (1.17.7) + faraday (>= 1.0, < 3.a) + google-cloud-env (~> 2.2) + google-logging-utils (~> 0.1) + jwt (>= 1.4, < 4.0) + os (>= 0.9, < 2.0) + pstore (~> 0.1) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-cookie (1.1.6) + domain_name (~> 0.5) + io-console (0.9.5) + irb (1.18.0) + pp (>= 0.6.0) + prism (>= 1.3.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + jmespath (1.6.2) + json (2.21.2) + jwt (3.3.0) + base64 + logger (1.7.0) + mini_magick (4.13.2) + mini_mime (1.1.5) + multi_json (1.21.2) + multipart-post (2.4.1) + mutex_m (0.3.0) + nanaimo (0.4.0) + naturally (2.3.0) + net-http (0.10.0) + net-protocol (>= 0.3.0) + uri (>= 0.11.1) + net-protocol (0.4.0) + timeout + nkf (0.3.0) + optparse (0.8.1) + os (1.1.4) + ostruct (0.6.3) + plist (3.7.2) + pp (0.6.4) + prettyprint + prettyprint (0.2.1) + prism (2.1.0) + pstore (0.3.0) + public_suffix (7.0.5) + rake (13.4.2) + rbs (4.1.3) + logger + prism (>= 1.6.0) + tsort + rdoc (8.1.0) + erb + prism (>= 1.6.0) + rbs (>= 4.0.0) + tsort + reline (0.7.0) + io-console (~> 0.5) + representable (3.3.1) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (4.2.0) + rexml (3.4.4) + rouge (3.28.0) + rubyzip (3.7.0) + security (0.4.0) + signet (0.22.2) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 4.0) + simctl (1.6.10) + CFPropertyList + naturally + terminal-notifier (3.1.0) + terminal-table (4.0.0) + unicode-display_width (>= 1.1.1, < 4) + timeout (0.6.1) + trailblazer-option (0.1.2) + tsort (0.2.0) + tty-cursor (0.7.1) + tty-screen (0.8.2) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + uber (0.1.0) + unicode-display_width (3.3.0) + unicode-emoji (~> 4.3) + unicode-emoji (4.3.0) + uri (1.1.2) + word_wrap (1.0.0) + xcodeproj (1.28.1) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + base64 + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.4.0) + nkf + rexml (>= 3.3.6, < 4.0) + xcpretty (0.4.1) + rouge (~> 3.28.0) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + arm64-darwin + arm64-darwin-24 + ruby + x86_64-darwin + x86_64-linux + +DEPENDENCIES + fastlane + +BUNDLED WITH + 2.7.2 diff --git a/apps/mobile/android/app/build.gradle.kts b/apps/mobile/android/app/build.gradle.kts index 83ea45d..2abec6d 100644 --- a/apps/mobile/android/app/build.gradle.kts +++ b/apps/mobile/android/app/build.gradle.kts @@ -1,9 +1,17 @@ +import java.util.Properties + plugins { id("com.android.application") // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id("dev.flutter.flutter-gradle-plugin") } +// release 서명: CI가 android/key.properties를 만든다. 없으면(로컬) debug 키로 서명. +val keystoreProperties = Properties().apply { + val file = rootProject.file("key.properties") + if (file.exists()) file.inputStream().use { load(it) } +} + android { namespace = "com.ject.highfive" compileSdk = flutter.compileSdkVersion @@ -48,11 +56,21 @@ android { } } + signingConfigs { + if (keystoreProperties.isNotEmpty()) { + create("release") { + storeFile = file(keystoreProperties.getProperty("storeFile")) + storeType = keystoreProperties.getProperty("storeType") + storePassword = keystoreProperties.getProperty("storePassword") + keyAlias = keystoreProperties.getProperty("keyAlias") + keyPassword = keystoreProperties.getProperty("keyPassword") + } + } + } + buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.getByName("debug") + signingConfig = signingConfigs.findByName("release") ?: signingConfigs.getByName("debug") } } } diff --git a/apps/mobile/android/app/src/main/AndroidManifest.xml b/apps/mobile/android/app/src/main/AndroidManifest.xml index 4bff20e..74b8675 100644 --- a/apps/mobile/android/app/src/main/AndroidManifest.xml +++ b/apps/mobile/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,5 @@ + | pbcopy`, 텍스트 파일은 `pbcopy < <파일>`로 복사해서 붙여넣는다. + +| Secret | 파일 / 값 | +| --- | --- | +| `IOS_DISTRIBUTION_P12_BASE64` | `Highfive_Distribution.p12` (base64) | +| `IOS_P12_PASSWORD` | `비밀번호.txt` | +| `IOS_PROFILE_PROD_BASE64` | `Highfive_AppStore.mobileprovision` (base64) | +| `IOS_PROFILE_DEV_BASE64` | `Highfive_Dev_AppStore.mobileprovision` (base64) | +| `ASC_KEY_ID` | App Store Connect API 키 ID (`highfive-ci`) | +| `ASC_ISSUER_ID` | App Store Connect Issuer ID | +| `ASC_KEY_P8` | `AuthKey_.p8` (원문) | +| `ANDROID_KEYSTORE_BASE64` | `highfive-upload.jks` (base64) | +| `ANDROID_KEYSTORE_PASSWORD` | `비밀번호.txt` | +| `ANDROID_KEY_PASSWORD` | keystore 암호와 같음 | +| `ANDROID_KEY_ALIAS` | `highfive-upload` | +| `PLAY_SERVICE_ACCOUNT_JSON` | `highfive-play-ci.json` (원문) | +| `SHOREBIRD_TOKEN` | Shorebird 콘솔(console.shorebird.dev)에서 발급한 API 키 | + +Apple Team ID(`Q4E6NKD9VN`)는 비밀이 아니라서 workflow에 직접 적었다. + +### 2. Branch protection (`develop`, `main`) +Settings → Branches → Require a pull request + Require status checks: `mobile / check`, `web / check`. + +## 처음 한 번은 수동 +- Google Play: 첫 AAB는 Play Console에서 직접 업로드해야 API 업로드가 가능. +- App Store Connect: `com.ject.highfive`, `com.ject.highfive.dev` 앱 레코드를 먼저 생성. + +## 긴급 patch 절차 +1. Actions → **Shorebird Patch** → flavor · platform · 대상 release version(예: `1.0.0+42`) 입력 후 실행 +2. staging 트랙에서 검증 (rollback 준비) +3. Shorebird 콘솔에서 stable로 수동 게시 → 설치된 앱 다음 실행 시 반영 + +네이티브 코드 · 권한 · SDK · 에셋 변경은 patch 불가 → 앱 release로 배포. +배포·patch 기록은 [workflow.md 6절](./workflow.md#6-릴리스긴급-수정)대로 `docs/releases.md`에 남긴다.