ios 如何在Github Actions上为TestFlight部署CICD

iyr7buue  于 2022-11-19  发布在  iOS
关注(0)|答案(1)|浏览(157)

我对部署CICD还是个新手。目前这是我的.yml文件:

name: Release IOS
on: 
  push:
    branches:
      - github-action
jobs:
  build:
    name: Build IPA and upload to TestFlight
    runs-on: macos-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Select Xcode Version
        uses: maxim-lobanov/setup-xcode@v1
        with:
          xcode-version: latest-stable
      - name: Setup SSH
        uses: webfactory/ssh-agent@v0.5.4
        with:
          ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
      - name: Setup ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 2.7.2
          bundler-cache: true
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 14.17.0
      - name: Install Cordova, Ionic, and cordova-res
        run: npm install -g cordova@10.0.0 @ionic/cli cordova-res
      - name: Install app dependencies
        run: npm install
      - name: npx gulp
        run: npx gulp
      - name: cordova resources
        run: ionic cordova resources
      - name: Remove Ios platform
        run: ionic cordova platform remove ios
      - name: Add Ios platform
        run: ionic cordova platform add ios
      - name: Fix translations problems in IOS
        run: ionic cordova plugin add cordova-plugin-ionic-webview
      - name: Install @ionic-native/ionic-webview
        run: npm install @ionic-native/ionic-webview
      - name: Prebuild iOS production
        run: npm run prod:ios
      - name: Uninstall outdated gems
        run: gem cleanup
      - name: Publish as internal testing
        uses: yukiarrr/ios-build-action@v1.5.0
        with:
          project-path: ./platforms/ios/MyProject.xcodeproj
          p12-base64: ${{ secrets.IOS_P12_BASE64 }}
          certificate-password: ${{ secrets.IOS_P12_PASSWORD }}
          mobileprovision-base64: ${{ secrets.IOS_PROVISION_FILE }}
          code-signing-identity: iOS Distribution
          team-id: ${{ secrets.TEAM_ID }}
          workspace-path: ./platforms/ios/MyProject.xcworkspace # optional

这就是我最后得到的结果:

[17:53:21]: $ set -o pipefail && xcodebuild -workspace ./platforms/ios/MyProject.xcworkspace -scheme MyProject -configuration Release -destination 'generic/platform=iOS' -archivePath /Users/runner/Library/Developer/Xcode/Archives/2022-05-16/output\ 2022-05-16\ 17.53.21.xcarchive clean archive | tee /Users/runner/Library/Logs/gym/MyProject-MyProject.log | xcpretty
[17:53:29]: ▸ Clean Succeeded
[17:53:39]: ▸ ❌  error: No certificate for team '***' matching 'iOS Distribution' found: Select a different signing certificate for CODE_SIGN_IDENTITY, a team that matches your selected certificate, or switch to automatic provisioning. (in target 'MyProject' from project 'MyProject')
[17:53:39]: ▸ ** ARCHIVE FAILED **
▸ Clean Succeeded

❌  error: No certificate for team '***' matching 'iOS Distribution' found: Select a different signing certificate for CODE_SIGN_IDENTITY, a team that matches your selected certificate, or switch to automatic provisioning. (in target 'MyProject' from project 'MyProject')

** ARCHIVE FAILED **
[17:53:39]: Exit status: 65
[17:53:39]: 
[17:53:39]: Maybe the error shown is caused by using the wrong version of Xcode
[17:53:39]: Found multiple versions of Xcode in '/Applications/'
[17:53:39]: Make sure you selected the right version for your project
[17:53:39]: This build process was executed using '/Applications/Xcode_13.2.1.app'
[17:53:39]: If you want to update your Xcode path, either
[17:53:39]: 
[17:53:39]: - Specify the Xcode version in your Fastfile
[17:53:39]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
[17:53:39]: 
[17:53:39]: - Specify an absolute path to your Xcode installation in your Fastfile
[17:53:39]: ▸ xcode_select "/Applications/Xcode8.app"
[17:53:39]: 
[17:53:39]: - Manually update the path using
[17:53:39]: ▸ sudo xcode-select -s /Applications/Xcode.app
[17:53:39]: 

+---------------+--------------------------------+
|               Build environment                |
+---------------+--------------------------------+
| xcode_path    | /Applications/Xcode_13.2.1.app |
| gym_version   | 2.205.2                        |
| export_method | app-store                      |
| sdk           | iPhoneOS15.2.sdk               |
+---------------+--------------------------------+

我很确定我的证书、代码签名身份和预置描述文件都是正确的,但当Publish as internal testing失败时,仍然会显示此错误。正确的调试方法是什么?
(我添加fastlane标签,因为这个插件是基于它构建的)

vzgqcmou

vzgqcmou1#

iOS有2种类型的证书,你必须使用分发来部署。我已经按照这篇文章,并成功地做到了,https://www.cobeisfresh.com/blog/how-to-implement-a-ci-cd-workflow-for-ios-using-github-actions你可以阅读更多关于文章

相关问题