From 03d2d29e2a8a91043f174dcc98af104209014dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=84=ED=98=95?= <108233361+ShapeKim98@users.noreply.github.com> Date: Sat, 5 Oct 2024 22:48:22 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20#135=20appstore=5Frelease,=20release?= =?UTF-8?q?=5Fupdate=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C=EC=9A=B0=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/appstore_release.yml | 66 ++++++++++++++++++++++++++ .github/workflows/release_update.yml | 29 +++++++++++ fastlane/Fastfile | 48 +++++++++++++++++++ fastlane/release_notes.txt | 1 + 4 files changed, 144 insertions(+) create mode 100644 .github/workflows/appstore_release.yml create mode 100644 .github/workflows/release_update.yml create mode 100644 fastlane/release_notes.txt diff --git a/.github/workflows/appstore_release.yml b/.github/workflows/appstore_release.yml new file mode 100644 index 00000000..58565225 --- /dev/null +++ b/.github/workflows/appstore_release.yml @@ -0,0 +1,66 @@ +# 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 + +on: + pull_request: + branches: [ "main" ] + +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: Install GitHub CLI + run: sudo apt-get install gh + + - name: Generate Project + env: + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }} + run: | + fastlane appstore_profile + make release + + - 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: 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 appstore_release + + - name: Check Appstore Review + 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 check_app_store_review diff --git a/.github/workflows/release_update.yml b/.github/workflows/release_update.yml new file mode 100644 index 00000000..51edf42d --- /dev/null +++ b/.github/workflows/release_update.yml @@ -0,0 +1,29 @@ +# 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 + +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/fastlane/Fastfile b/fastlane/Fastfile index 210d7898..07ac54cb 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -84,4 +84,52 @@ platform :ios do 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/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