From 3caa6bce8449f288808e7e72a449b6afa8881965 Mon Sep 17 00:00:00 2001 From: sonohoshi Date: Fri, 17 May 2024 15:51:04 +0900 Subject: [PATCH] 9cK ios cicd setup --- .../ios-build-and-release-for-9ck.yml | 191 ++++++++++++++++++ .../Scripts/Editor/AirbridgeSettingsWindow.cs | 2 +- nekoyume/Assets/Editor/Builder.cs | 1 + 3 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ios-build-and-release-for-9ck.yml diff --git a/.github/workflows/ios-build-and-release-for-9ck.yml b/.github/workflows/ios-build-and-release-for-9ck.yml new file mode 100644 index 0000000000..544acb69b2 --- /dev/null +++ b/.github/workflows/ios-build-and-release-for-9ck.yml @@ -0,0 +1,191 @@ +name: iOS Build and Release for 9cK + +on: + push: + branches: + - main + - release/* + - fast-track/* + tags: ["*"] + pull_request: + types: [ready_for_review, opened, reopened, auto_merge_enabled] + workflow_dispatch: + inputs: + clo: + description: "Assets/StreamingAssets/clo.json" + required: false + type: string + default: "" + version-code: + description: "App Store Connect VersionCode" + app-version: + description: "App Store Connect VersionName ex(40.0.0)" + manual_build_option: + description: "Please turn on the option when manually executing the action" + type: boolean + required: false + default: false + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +env: + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} + +jobs: + build: + name: Build for ${{ matrix.targetPlatform }} + runs-on: + labels: ["linux", "8cores"] + defaults: + run: + shell: bash + strategy: + matrix: + projectPath: + - nekoyume + targetPlatform: + - iOS + env: + APPLE_CONNECT_EMAIL: ${{ secrets.APPLE_CONNECT_EMAIL }} + APPLE_DEVELOPER_EMAIL: ${{ secrets.APPLE_DEVELOPER_EMAIL }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + APPLE_TEAM_NAME: ${{ secrets.APPLE_TEAM_NAME }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + MATCH_PERSONAL_ACCESS_TOKEN: ${{ secrets.MATCH_PERSONAL_ACCESS_TOKEN }} + IOS_APP_ID: com.planetariumlabs.ninechroniclesmobilek + IOS_BUILD_PATH: ${{ format('{0}/build/iOS', github.workspace) }} + PROJECT_NAME: NineChronicles + RELEASE_NOTES: ${{ github.event.release.body }} + MATCH_REPOSITORY_ACCOUNT: ${{ secrets.MATCH_REPOSITORY_ACCOUNT }} + USYM_UPLOAD_AUTH_TOKEN: 'fake' + GOOGLE_SERVICE_INFO: ${{ secrets.GOOGLE_SERVICE_INFO_K }} + + steps: + - name: Set CRLF + run: | + git config --global core.autocrlf true + + - name: Checkout Repository + uses: actions/checkout@v3 + with: + lfs: true + submodules: true + + - name: Cache restore for debug + uses: actions/cache@v3 + with: + path: ${{ matrix.projectPath }}/Library + key: Library-${{ matrix.projectPath }}-macos-${{ matrix.targetPlatform }} + restore-keys: | + Library-${{ matrix.projectPath }}-macos- + + - name: Copy clo.json + run: | + if [ -n "${{ github.event.inputs.clo }}" ]; then + echo ${{ github.event.inputs.clo }} > ${{ matrix.projectPath }}/Assets/StreamingAssets/clo.json + fi + + - name: Decode GoogleService-Info.plist File + run: | + echo "$GOOGLE_SERVICE_INFO" | base64 -d > ${{ matrix.projectPath }}/Assets/GoogleService-Info.plist + # echo "$GOOGLE_SERVICE_INFO" | base64 -D -o ${{ matrix.projectPath }}/Assets/GoogleService-Info.plist + + - name: Change cloudProjectId in ProjectSettings.asset + run: | + sed -i '/cloudProjectId/c\ cloudProjectId: fa57c419-1189-418d-951c-055e5f9738d0' ${{ matrix.projectPath }}/ProjectSettings/ProjectSettings.asset + cat ${{ matrix.projectPath }}/ProjectSettings/ProjectSettings.asset + + - name: Free Disk Space + run: | + sudo swapoff -a + sudo rm -f /swapfile + sudo apt clean + docker rmi $(docker image ls -aq) + df -h + + - uses: game-ci/unity-builder@v4 + with: + projectPath: ${{ matrix.projectPath }} + targetPlatform: ${{ matrix.targetPlatform }} + buildMethod: 'Editor.Builder.Build${{ matrix.targetPlatform }}' + buildName: ${{ matrix.targetPlatform }} + versioning: Custom + version: ${{ github.event.inputs.app-version }} + allowDirtyBuild: true + customParameters: -identifier "$IOS_APP_ID" + + - uses: actions/upload-artifact@v3 + with: + name: Build-${{ matrix.targetPlatform }} + path: build/${{ matrix.targetPlatform }} + + build-and-upload: + name: Build Archive for iOS and Upload to TestFlight + runs-on: macos-13 + timeout-minutes: 60 + needs: build + if: startsWith(github.ref, 'refs/heads/release/') || startsWith(github.event.ref, 'refs/tags/')|| github.event.inputs.manual_build_option + strategy: + matrix: + projectPath: + - nekoyume + targetPlatform: + - iOS + env: + APPLE_CONNECT_EMAIL: ${{ secrets.APPLE_CONNECT_EMAIL }} + APPLE_DEVELOPER_EMAIL: ${{ secrets.APPLE_DEVELOPER_EMAIL }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + APPLE_TEAM_NAME: ${{ secrets.APPLE_TEAM_NAME }} + FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} + FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + MATCH_PERSONAL_ACCESS_TOKEN: ${{ secrets.MATCH_PERSONAL_ACCESS_TOKEN }} + MATCH_REPOSITORY_ACCOUNT: ${{ secrets.MATCH_REPOSITORY_ACCOUNT }} + IOS_APP_ID: com.planetariumlabs.ninechroniclesmobilek + IOS_BUILD_PATH: ${{ format('{0}/build/iOS', github.workspace) }} + PROJECT_NAME: NineChronicles + RELEASE_NOTES: ${{ github.event.release.body }} + USYM_UPLOAD_AUTH_TOKEN: 'fake' + GOOGLE_SERVICE_INFO: ${{ secrets.GOOGLE_SERVICE_INFO_K }} + GIT_REPO_CERT: ${{ secrets.GIT_REPO_CERT }} + ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }} + ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }} + ASC_KEY_CONTENT: ${{ secrets.ASC_KEY_CONTENT }} + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Download iOS Artifact + uses: actions/download-artifact@v3 + with: + name: Build-${{ matrix.targetPlatform }} + path: build/${{ matrix.targetPlatform }} + + - name: Cache restore cocoapods + uses: actions/cache@v2 + if: ${{ always() }} + with: + path: | + 'build/iOS/Nine Chronicles M/Pods' + ~/.cocoapods/repos + key: Pods-${{ hashFiles('**/Podfile') }} + restore-keys: Pods- + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + + - name: Archive iOS + uses: maierj/fastlane-action@v3.0.0 + with: + lane: 'ios build' + + - name: Upload to the App Store + uses: maierj/fastlane-action@v3.0.0 + with: + lane: 'ios beta' diff --git a/nekoyume/Assets/Airbridge/Scripts/Editor/AirbridgeSettingsWindow.cs b/nekoyume/Assets/Airbridge/Scripts/Editor/AirbridgeSettingsWindow.cs index fec5ccd727..f15ec825d8 100644 --- a/nekoyume/Assets/Airbridge/Scripts/Editor/AirbridgeSettingsWindow.cs +++ b/nekoyume/Assets/Airbridge/Scripts/Editor/AirbridgeSettingsWindow.cs @@ -199,7 +199,7 @@ public static void UpdateAndroidManifest() manifest.Save(manifestPath); } - private void UpdateiOSAppSetting() + public static void UpdateiOSAppSetting() { string path = Path.Combine(Application.dataPath, "Plugins/Airbridge/iOS/Delegate/AUAppSetting.h"); if (!File.Exists(path)) diff --git a/nekoyume/Assets/Editor/Builder.cs b/nekoyume/Assets/Editor/Builder.cs index df88e1a94c..11502b608f 100644 --- a/nekoyume/Assets/Editor/Builder.cs +++ b/nekoyume/Assets/Editor/Builder.cs @@ -129,6 +129,7 @@ public static void BuildiOS() { EditorUserBuildSettings.il2CppCodeGeneration = UnityEditor.Build.Il2CppCodeGeneration.OptimizeSize; SetByCommandLineArguments(); + AirbridgeSettingsWindow.UpdateiOSAppSetting(); Debug.Log("Build iOS"); PreProcessBuildForIOS(); PlayerSettings.iOS.sdkVersion = iOSSdkVersion.DeviceSDK;