diff --git a/.github/workflows/hotfix.yml b/.github/workflows/appstore_release.yml similarity index 74% rename from .github/workflows/hotfix.yml rename to .github/workflows/appstore_release.yml index 6c7b4ebf..bd63256e 100644 --- a/.github/workflows/hotfix.yml +++ b/.github/workflows/appstore_release.yml @@ -1,11 +1,12 @@ # This workflow will build a Swift project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift -name: hotfix +name: appstore-release on: - push: - branches: [ "hotfix/*" ] + pull_request: + branches: + - main jobs: build: @@ -17,12 +18,12 @@ jobs: - name: Set up Xcode uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '15.4' + xcode-version: latest-stable - # - uses: shimataro/ssh-key-action@v2 - # with: - # key: ${{ secrets.SSH_KEY }} - # known_hosts: ${{ secrets.KNOWN_HOSTS }} + - uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.SSH_KEY }} + known_hosts: ${{ secrets.KNOWN_HOSTS }} - name: initial mise run: | @@ -36,10 +37,10 @@ jobs: - name: Generate Project env: MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - MATCH_URL: ${{ secrets.MATCH_URL }} - APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }} DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }} - run: fastlane generate + run: | + fastlane appstore_profile + make release - name: Build Archive env: @@ -48,9 +49,9 @@ jobs: APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }} run: fastlane archive - - name: Beta Release + - name: Appstore Release env: APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }} APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }} - run: fastlane release + run: fastlane appstore_release diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index e0f7bc91..d27957cc 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -5,7 +5,10 @@ name: build-test on: pull_request: - branches: [ "develop" ] + branches: + - develop + + workflow_dispatch: jobs: build: @@ -17,7 +20,7 @@ jobs: - name: Set up Xcode uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '15.4' + xcode-version: latest-stable - uses: shimataro/ssh-key-action@v2 with: @@ -36,10 +39,10 @@ jobs: - name: Test Generate env: MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - MATCH_URL: ${{ secrets.MATCH_URL }} - APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }} DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }} - run: fastlane test + run: | + fastlane development_profile + make test - name: Build Test run: fastlane build diff --git a/.github/workflows/release_update.yml b/.github/workflows/release_update.yml new file mode 100644 index 00000000..8104f099 --- /dev/null +++ b/.github/workflows/release_update.yml @@ -0,0 +1,31 @@ +# This workflow will build a Swift project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift + +name: release-update + +on: + pull_request: + branches: + - main + types: + - closed + +jobs: + release-update: + if: ${{ github.event.pull_request.merged == true }} + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install GitHub CLI + run: sudo apt-get install gh + + - name: Update Release + env: + APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }} + APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} + APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + run: fastlane update_github_release diff --git a/.github/workflows/testflight_release.yml b/.github/workflows/testflight_release.yml index 0ccfd05e..aaf83977 100644 --- a/.github/workflows/testflight_release.yml +++ b/.github/workflows/testflight_release.yml @@ -1,14 +1,20 @@ # This workflow will build a Swift project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift -name: testflight_release +name: testflight-release on: - push: - branches: [ "develop" ] + pull_request: + branches: + - develop + types: + - closed + + workflow_dispatch: jobs: build: + if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }} runs-on: macos-latest steps: @@ -17,7 +23,7 @@ jobs: - name: Set up Xcode uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '15.4' + xcode-version: latest-stable - uses: shimataro/ssh-key-action@v2 with: @@ -36,10 +42,10 @@ jobs: - name: Generate Project env: MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - MATCH_URL: ${{ secrets.MATCH_URL }} - APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }} DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }} - run: fastlane generate + run: | + fastlane appstore_profile + make release - name: Build Archive env: @@ -48,9 +54,9 @@ jobs: APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }} run: fastlane archive - - name: Beta Release + - name: Testflight Release env: APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }} APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }} - run: fastlane release + run: fastlane testflight_release diff --git a/.github/workflows/workflow_test.yml b/.github/workflows/workflow_test.yml deleted file mode 100644 index 606764de..00000000 --- a/.github/workflows/workflow_test.yml +++ /dev/null @@ -1,67 +0,0 @@ -# This workflow will build a Swift project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift - -name: workflow_test - -on: - push: - branches: [ "workflow/*" ] - -jobs: - build: - runs-on: macos-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up Xcode - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '15.4' - - # - uses: shimataro/ssh-key-action@v2 - # with: - # key: ${{ secrets.SSH_KEY }} - # known_hosts: ${{ secrets.KNOWN_HOSTS }} - - - name: initial mise - run: | - curl https://mise.jdx.dev/install.sh | sh - echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH - echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH - - - name: initial tuist - run: mise install tuist - - - name: Test Generate - env: - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - MATCH_URL: ${{ secrets.MATCH_URL }} - APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }} - DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }} - run: fastlane test - - - name: Build Test - run: fastlane build - - - name: Release Generate - env: - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - MATCH_URL: ${{ secrets.MATCH_URL }} - APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }} - DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }} - run: fastlane generate - - - name: Build Archive - env: - APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }} - APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} - APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }} - run: fastlane archive - - - name: Beta Release - env: - APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }} - APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} - APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }} - run: fastlane release diff --git a/Makefile b/Makefile index 8a090c56..5e4d72bd 100644 --- a/Makefile +++ b/Makefile @@ -52,13 +52,14 @@ download-privates: @if [ ! -d "Pokit_iOS_Private" ]; then \ git clone git@github.com:stealmh/Pokit_iOS_Private.git; \ fi - @if [ -f "Pokit_iOS_Private/xcconfig/Secret.xcconfig" ]; then \ + @if [ -f "Pokit_iOS_Private/xcconfig/Debug.xcconfig" ] && [ -f "Pokit_iOS_Private/xcconfig/Release.xcconfig" ]; then \ mkdir -p xcconfig; \ - cp Pokit_iOS_Private/xcconfig/Secret.xcconfig xcconfig/Secret.xcconfig; \ + cp Pokit_iOS_Private/xcconfig/Debug.xcconfig xcconfig/Debug.xcconfig; \ + cp Pokit_iOS_Private/xcconfig/Release.xcconfig xcconfig/Release.xcconfig; \ cp Pokit_iOS_Private/auth/AuthKey.p8 Projects/CoreKit/Resources/AuthKey.p8; \ cp Pokit_iOS_Private/GoogleService-Info.plist Projects/App/Resources/GoogleService-Info.plist; \ rm -rf Pokit_iOS_Private; \ - echo "✅ Secret 파일을 성공적으로 다운로드하고 Pokit_iOS_Private 폴더를 삭제했습니다."; \ + echo "✅ Debug.xcconfig와 Release.xcconfig 파일을 성공적으로 다운로드하고 Pokit_iOS_Private 폴더를 삭제했습니다."; \ else \ - echo "❌ Secret.xcconfig 파일을 찾을 수 없습니다."; \ + echo "❌ Debug.xcconfig 또는 Release.xcconfig 파일을 찾을 수 없습니다." && exit 1; \ fi diff --git a/Projects/App/Project.swift b/Projects/App/Project.swift index 7b965c96..0cafa325 100644 --- a/Projects/App/Project.swift +++ b/Projects/App/Project.swift @@ -37,17 +37,13 @@ let project = Project( .external(name: "FirebaseMessaging") ], settings: .settings( - base: [ - "OTHER_LDFLAGS": "$(inherited) -ObjC", - "CODE_SIGN_IDENTITY": "Apple Distribution", - "PROVISIONING_PROFILE_SPECIFIER": "match AppStore com.pokitmons.pokit 1721720816", - "PROVISIONING_PROFILE": "match AppStore com.pokitmons.pokit 1721720816", - "DEVELOPMENT_TEAM": "\(developmentTeam ?? "")" - ], - configurations: [ - .debug(name: "Debug", xcconfig: .relativeToRoot("xcconfig/Secret.xcconfig")), - .release(name: "Release", xcconfig: .relativeToRoot("xcconfig/Secret.xcconfig")) - ] + .release( + name: "Release", + settings: [ + "CODE_SIGN_IDENTITY": "Apple Distribution" + ], + xcconfig: .relativeToRoot("xcconfig/Release.xcconfig") + ) ) ) ] diff --git a/Projects/CoreKit/Project.swift b/Projects/CoreKit/Project.swift index ea0dd934..2679bc2b 100644 --- a/Projects/CoreKit/Project.swift +++ b/Projects/CoreKit/Project.swift @@ -37,19 +37,10 @@ let coreKit: Target = .target( .external(name: "KakaoSDKShare"), .external(name: "KakaoSDKTemplate"), ], - settings: .settings( - base: [ - "OTHER_LDFLAGS": "$(inherited) -ObjC", - ], - configurations: [ - .debug(name: "Debug", xcconfig: .relativeToRoot("xcconfig/Secret.xcconfig")), - .release(name: "Release", xcconfig: .relativeToRoot("xcconfig/Secret.xcconfig")) - ] - ) + settings: .settings() ) let project = Project( name: "CoreKit", - settings: .settings, targets: [coreKit] ) diff --git a/Projects/DSKit/Project.swift b/Projects/DSKit/Project.swift index 0c0dd71c..eddcf7c3 100644 --- a/Projects/DSKit/Project.swift +++ b/Projects/DSKit/Project.swift @@ -26,7 +26,8 @@ let project = Project( // TODO: 의존성 추가 .project(target: "Util", path: .relativeToRoot("Projects/Util")), .external(name: "NukeUI") - ] + ], + settings: .settings() ) ] ) diff --git a/Projects/Domain/Project.swift b/Projects/Domain/Project.swift index 02662fef..baec5764 100644 --- a/Projects/Domain/Project.swift +++ b/Projects/Domain/Project.swift @@ -26,7 +26,7 @@ let project = Project( .project(target: "SharedThirdPartyLib", path: .relativeToRoot("Projects/SharedThirdPartyLib")), .project(target: "CoreKit", path: .relativeToRoot("Projects/CoreKit")) ], - settings: .settings + settings: .settings() ) ] ) diff --git a/Projects/SharedThirdPartyLib/Project.swift b/Projects/SharedThirdPartyLib/Project.swift index ff80eec2..a362e892 100644 --- a/Projects/SharedThirdPartyLib/Project.swift +++ b/Projects/SharedThirdPartyLib/Project.swift @@ -24,7 +24,7 @@ let project = Project( // TODO: 의존성 추가 .external(name: "ComposableArchitecture") ], - settings: .settings + settings: .settings() ) ] ) diff --git a/Projects/Util/Project.swift b/Projects/Util/Project.swift index e5c44d37..30f6daf6 100644 --- a/Projects/Util/Project.swift +++ b/Projects/Util/Project.swift @@ -22,7 +22,8 @@ let project = Project( sources: ["Sources/**"], dependencies: [ // TODO: 의존성 추가 - ] + ], + settings: .settings() ) ] ) diff --git a/Tuist/ProjectDescriptionHelpers/Settings+Extension.swift b/Tuist/ProjectDescriptionHelpers/Settings+Extension.swift index d869536e..47a914d2 100644 --- a/Tuist/ProjectDescriptionHelpers/Settings+Extension.swift +++ b/Tuist/ProjectDescriptionHelpers/Settings+Extension.swift @@ -8,11 +8,21 @@ import ProjectDescription public extension Settings { - static var settings: Settings { - return .settings( + static func settings(_ release: Configuration? = nil) -> Settings { + var settings: Settings = .settings( base: [ "OTHER_LDFLAGS": "$(inherited) -ObjC", + "CODE_SIGN_STYLE": "Manual" + ], + configurations: [ + .debug(name: "Debug", xcconfig: .relativeToRoot("xcconfig/Debug.xcconfig")) ] ) + + if let release { + settings.configurations.append(release) + } + + return settings } } diff --git a/Tuist/ProjectDescriptionHelpers/Target+Extension.swift b/Tuist/ProjectDescriptionHelpers/Target+Extension.swift index fe2bcc3c..486c516f 100644 --- a/Tuist/ProjectDescriptionHelpers/Target+Extension.swift +++ b/Tuist/ProjectDescriptionHelpers/Target+Extension.swift @@ -26,7 +26,7 @@ public extension Target { sources: ["\(name)/Sources/**"], resources: resources, dependencies: dependencies, - settings: .settings + settings: .settings() ) } @@ -44,7 +44,7 @@ public extension Target { deploymentTargets: .appMinimunTarget, sources: ["Sources/\(name)/Sources/**"], dependencies: dependencies, - settings: .settings + settings: .settings() ) } } diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 6dcc5811..07ac54cb 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -16,7 +16,7 @@ default_platform(:ios) platform :ios do - lane :generate do + lane :appstore_profile do setup_ci match( @@ -24,38 +24,24 @@ platform :ios do app_identifier:["com.pokitmons.pokit"], readonly: true ) - - Dir.chdir("../") do - sh("make release") - end end - lane :test do + lane :development_profile do setup_ci match( - type: "appstore", + type: "development", app_identifier:["com.pokitmons.pokit"], readonly: true ) - - Dir.chdir("../") do - sh("make test") - end end lane :build do build_app( workspace: "Pokit.xcworkspace", scheme: "App", - export_method: "app-store", - export_options: { - method: "app-store", - signingStyle: "manual", - provisioningProfiles: { - "com.pokitmons.pokit" => "match AppStore com.pokitmons.pokit 1721720816" - } - } + configuration: "Debug", + export_method: "development", ) end @@ -79,18 +65,12 @@ platform :ios do build_app( workspace: "Pokit.xcworkspace", scheme: "App", - export_method: "app-store", - export_options: { - method: "app-store", - signingStyle: "manual", - provisioningProfiles: { - "com.pokitmons.pokit" => "match AppStore com.pokitmons.pokit 1721720816" - } - } + configuration: "Release", + export_method: "app-store" ) end - lane :release do + lane :testflight_release do api_key = app_store_connect_api_key( key_id: ENV['APP_STORE_CONNECT_KEY_ID'], issuer_id: ENV['APP_STORE_CONNECT_ISSUER_ID'], @@ -99,8 +79,57 @@ platform :ios do upload_to_testflight( api_key: api_key, - distribute_external: false, + distribute_external: true, + groups: ["Pokitmons"], changelog: "" ) end + + lane :appstore_release do + api_key = app_store_connect_api_key( + key_id: ENV['APP_STORE_CONNECT_KEY_ID'], + issuer_id: ENV['APP_STORE_CONNECT_ISSUER_ID'], + key_content: ENV['APP_STORE_CONNECT_API'] + ) + + release_notes = File.read("release_notes.txt") + + upload_to_app_store( + api_key: api_key, + skip_metadata: true, + skip_screenshots: true, + release_notes: { + "ko" => release_notes + }, + submit_for_review: true, + automatic_release: true + ) + end + + lane :update_github_release do + require 'spaceship' + + api_key = app_store_connect_api_key( + key_id: ENV['APP_STORE_CONNECT_KEY_ID'], + issuer_id: ENV['APP_STORE_CONNECT_ISSUER_ID'], + key_content: ENV['APP_STORE_CONNECT_API'] + ) + + Spaceship::ConnectAPI.login(api_key: api_key) + + app = Spaceship::ConnectAPI::App.find("com.pokitmons.pokit") + + live_version = app.get_live_version + app_state = live_version.app_store_state + app_version = live_version.version_string + + if app_state == 'READY_FOR_SALE' + pr_number = ENV['PR_NUMBER'] + pr_body = sh("gh pr view #{pr_number} --json body --jq '.body'") + release_notes = pr_body.strip + + # GitHub 릴리즈 버전 및 릴리즈 노트 업데이트 + sh("gh release create v#{app_version} --notes '#{release_notes}'") + end + end end diff --git a/fastlane/Matchfile b/fastlane/Matchfile index 591d5fd3..6648ebc2 100644 --- a/fastlane/Matchfile +++ b/fastlane/Matchfile @@ -1,8 +1,8 @@ -git_url(ENV['MATCH_URL']) +git_url('git@github.com:stealmh/Pokit_iOS_Private.git') storage_mode("git") -type("appstore") # The default type, can be: appstore, adhoc, enterprise or development +type("development") # The default type, can be: appstore, adhoc, enterprise or development app_identifier(["com.pokitmons.pokit"]) username("shapekim98@gmail.com") # Your Apple Developer Portal username diff --git a/fastlane/release_notes.txt b/fastlane/release_notes.txt new file mode 100644 index 00000000..fba8c666 --- /dev/null +++ b/fastlane/release_notes.txt @@ -0,0 +1 @@ +- 자잘한 버그 및 사용성을 개선했어요. \ No newline at end of file