-
Notifications
You must be signed in to change notification settings - Fork 1
[chore] Android/iOS 릴리즈 빌드 CI 자동화 (AAB/IPA 산출물 추출) #317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
415e74a
f6a13a6
7301648
567b0f6
9ef26cc
d7a6441
f461d43
5a3bf81
4812211
d19ac47
64abcf0
1e789dd
0d777ae
65626f1
d378730
858364c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,188 @@ | ||
| name: Release Build (AAB / IPA) | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| concurrency: | ||
| group: release-build-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| android-build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Enable Corepack (pnpm) | ||
| run: | | ||
| corepack enable | ||
| pnpm -v | ||
|
|
||
| - name: Setup Node (with pnpm cache) | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: pnpm | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install | ||
|
|
||
| - name: Build web assets | ||
| run: pnpm build | ||
|
|
||
| - name: Sync Capacitor (android) | ||
| run: npx cap sync android | ||
|
|
||
| - name: Setup JDK | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: "21" | ||
|
|
||
| - name: Setup Android SDK | ||
| uses: android-actions/setup-android@v3 | ||
|
|
||
| - name: Decode keystore | ||
| run: | | ||
| echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > android/app/release.keystore | ||
|
|
||
| - name: Write keystore.properties | ||
| run: | | ||
| cat <<EOF > android/keystore.properties | ||
| storeFile=app/release.keystore | ||
| storePassword=${{ secrets.ANDROID_KEYSTORE_STORE_PASSWORD }} | ||
| keyAlias=${{ secrets.ANDROID_KEYSTORE_KEY_ALIAS }} | ||
| keyPassword=${{ secrets.ANDROID_KEYSTORE_KEY_PASSWORD }} | ||
| EOF | ||
|
|
||
| - name: Build release AAB | ||
| working-directory: android | ||
| run: | | ||
| chmod +x gradlew | ||
| ./gradlew bundleRelease --no-daemon | ||
|
|
||
| - name: Upload AAB artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: app-release-aab | ||
| path: android/app/build/outputs/bundle/release/*.aab | ||
| retention-days: 14 | ||
|
|
||
| ios-build: | ||
| runs-on: macos-latest | ||
| env: | ||
| TEAM_ID: YC7R5A6449 | ||
| # 심사 통과 전이므로 development로 기본 설정. 심사 통과 후 배포용으로 전환 시 app-store로 변경. | ||
| EXPORT_METHOD: development | ||
| BUNDLE_ID: com.finders.app | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Enable Corepack (pnpm) | ||
| run: | | ||
| corepack enable | ||
| pnpm -v | ||
|
|
||
| - name: Setup Node (with pnpm cache) | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: pnpm | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install | ||
|
|
||
| - name: Build web assets | ||
| run: pnpm build | ||
|
|
||
| - name: Sync Capacitor (ios) | ||
| run: npx cap sync ios | ||
|
|
||
| - name: Import signing certificate & provisioning profile | ||
| env: | ||
| CERTIFICATE_BASE64: ${{ secrets.IOS_DIST_CERTIFICATE_P12_BASE64 }} | ||
| CERTIFICATE_PASSWORD: ${{ secrets.IOS_DIST_CERTIFICATE_PASSWORD }} | ||
| PROFILE_BASE64: ${{ secrets.IOS_PROVISION_PROFILE_BASE64 }} | ||
| run: | | ||
| KEYCHAIN_PASSWORD=$(openssl rand -base64 24) | ||
| KEYCHAIN_PATH="$RUNNER_TEMP/app-signing.keychain-db" | ||
| CERT_PATH="$RUNNER_TEMP/certificate.p12" | ||
| PROFILE_PATH="$RUNNER_TEMP/profile.mobileprovision" | ||
|
|
||
| echo "$CERTIFICATE_BASE64" | base64 -d -o "$CERT_PATH" | ||
| echo "$PROFILE_BASE64" | base64 -d -o "$PROFILE_PATH" | ||
|
|
||
| security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" | ||
| security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH" | ||
| security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" | ||
| security import "$CERT_PATH" -P "$CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" -T /usr/bin/codesign | ||
| security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" | ||
| security list-keychain -d user -s "$KEYCHAIN_PATH" $(security list-keychains -d user | sed 's/"//g') | ||
|
|
||
| mkdir -p ~/Library/MobileDevice/"Provisioning Profiles" | ||
| cp "$PROFILE_PATH" ~/Library/MobileDevice/"Provisioning Profiles"/profile.mobileprovision | ||
|
|
||
| PROFILE_UUID=$(security cms -D -i "$PROFILE_PATH" | /usr/libexec/PlistBuddy -c "Print UUID" /dev/stdin) | ||
| PROFILE_NAME=$(security cms -D -i "$PROFILE_PATH" | /usr/libexec/PlistBuddy -c "Print Name" /dev/stdin) | ||
|
|
||
| echo "PROFILE_UUID=$PROFILE_UUID" >> "$GITHUB_ENV" | ||
| echo "PROFILE_NAME=$PROFILE_NAME" >> "$GITHUB_ENV" | ||
| echo "KEYCHAIN_PATH=$KEYCHAIN_PATH" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Archive | ||
| working-directory: ios/App | ||
| run: | | ||
| xcodebuild -workspace App.xcworkspace \ | ||
| -scheme App \ | ||
| -configuration Release \ | ||
| -archivePath "$RUNNER_TEMP/App.xcarchive" \ | ||
| -destination "generic/platform=iOS" \ | ||
| CODE_SIGN_STYLE=Manual \ | ||
| CODE_SIGN_IDENTITY="Apple Distribution" \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 확인해보니 문제가 될 것 같아서 저희는 테스트 플라이트에서 내부 테스트를 하는 용도이기 때문에 |
||
| DEVELOPMENT_TEAM="$TEAM_ID" \ | ||
| PROVISIONING_PROFILE_SPECIFIER="$PROFILE_NAME" \ | ||
| OTHER_CODE_SIGN_FLAGS="--keychain $KEYCHAIN_PATH" \ | ||
| archive | ||
|
|
||
| - name: Create ExportOptions.plist | ||
| run: | | ||
| cat <<EOF > "$RUNNER_TEMP/ExportOptions.plist" | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>method</key> | ||
| <string>$EXPORT_METHOD</string> | ||
| <key>teamID</key> | ||
| <string>$TEAM_ID</string> | ||
| <key>signingStyle</key> | ||
| <string>manual</string> | ||
| <key>provisioningProfiles</key> | ||
| <dict> | ||
| <key>$BUNDLE_ID</key> | ||
| <string>$PROFILE_NAME</string> | ||
| </dict> | ||
| </dict> | ||
| </plist> | ||
| EOF | ||
|
|
||
| - name: Export IPA | ||
| run: | | ||
| xcodebuild -exportArchive \ | ||
| -archivePath "$RUNNER_TEMP/App.xcarchive" \ | ||
| -exportPath "$RUNNER_TEMP/build" \ | ||
| -exportOptionsPlist "$RUNNER_TEMP/ExportOptions.plist" | ||
|
|
||
| - name: Upload IPA artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: app-release-ipa | ||
| path: ${{ runner.temp }}/build/*.ipa | ||
| retention-days: 14 | ||
|
|
||
| - name: Cleanup keychain | ||
| if: always() | ||
| run: security delete-keychain "$KEYCHAIN_PATH" || true | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MUST:이거 github secrests로 빌드 하려면env:으로 명시 참조해야 주입됩니당