xcode - 如何使用 GitHub Actions 安装私有(private) Pod?

标签 xcode github cocoapods github-actions

我正在尝试在我的工作流脚本上安装我的依赖项。但是,有些是私有(private) pod,当我尝试执行 bundle exec pod install 时,它给了我这个错误:

Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs`
Cloning spec repo `keterauk` from `https://github.com/KeteraUK/Strive-Pod-Specs`
[!] Unable to add a source with url `https://github.com/KeteraUK/Strive-Pod-Specs` named `keterauk`.
You can try adding it manually in `/Users/runner/.cocoapods/repos` or via `pod repo add`.
##[error]Process completed with exit code 1.
pod repo add...导致此错误:fatal: could not read Username for 'https://github.com': Device not configured即使我添加了我的个人访问 token ( secret )。
这是我的完整脚本:
name: Swift

on:
  push:
    branches: 
      - master
      - enhancement/*
      - develop
      - develop/*
      - release
      - release/*

jobs:
  test:
    name: Test
    runs-on: macOS-latest
    strategy:
      matrix:
        destination: ['platform=iOS Simulator,OS=13.3,name=iPhone 11']
        xcode: ['/Applications/Xcode_11.6.app/Contents/Developer']
    steps:
      - name: Checkout
        uses: actions/checkout@v1
        with:
          token: ${{ secrets.STRIVE_ACTIONS_SECRET }} # PAT
      - name: Bundle Update
        run: gem install bundler:1.17.2
      - name: Bundle Install
        run: bundle install

# Currently fails here...
      - name: Specs Repo
        run: pod repo add Strive-Pod-Specs https://github.com/KeteraUK/Strive-Pod-Specs.git

      - name: Dependencies
        run: bundle exec pod install
        env:
          DEVELOPER_DIR: ${{ matrix.xcode }}
      - name: Build and test
        run: bundle exec fastlane scan --destination "${destination}" --scheme "CI"
        env:
          destination: ${{ matrix.destination }}
          DEVELOPER_DIR: ${{ matrix.xcode }}
如何使用我的工作流 GitHub Actions 脚本安装私有(private) pod?
注意:我也试图通过一个组织来做到这一点。

最佳答案

您尚未在 pod repo add https://github... 中提供 API token 命令,很可能因此而失败。请将您的个人 API token 添加到 github url,例如 <token>@github.com .您可以使用 secretsenv做同样的事情。
以下内容很可能有助于传递您遇到的错误:

name: Swift

on:
  push:
    branches: 
      - master
      - enhancement/*
      - develop
      - develop/*
      - release
      - release/*

jobs:
  test:
    name: Test
    runs-on: macOS-latest
    strategy:
      matrix:
        destination: ['platform=iOS Simulator,OS=13.3,name=iPhone 11']
        xcode: ['/Applications/Xcode_11.6.app/Contents/Developer']
    steps:
      - name: Checkout
        uses: actions/checkout@v1
        with:
          token: ${{ secrets.STRIVE_ACTIONS_SECRET }} # PAT
      - name: Bundle Update
        run: gem install bundler:1.17.2
      - name: Bundle Install
        run: bundle install

      - name: Specs Repo
        run: pod repo add Strive-Pod-Specs https://${POD_GITHUB_API_TOKEN}@github.com/KeteraUK/Strive-Pod-Specs.git
        env:
          POD_GITHUB_API_TOKEN: ${{ secrets.POD_GITHUB_API_TOKEN }}
      - name: Dependencies
        run: bundle exec pod install
        env:
          DEVELOPER_DIR: ${{ matrix.xcode }}
      - name: Build and test
        run: bundle exec fastlane scan --destination "${destination}" --scheme "CI"
        env:
          destination: ${{ matrix.destination }}
          DEVELOPER_DIR: ${{ matrix.xcode }}
修改后的行是:
            run: pod repo add Strive-Pod-Specs https://${POD_GITHUB_API_TOKEN}@github.com/KeteraUK/Strive-Pod-Specs.git
            env:
              POD_GITHUB_API_TOKEN: ${{ secrets.POD_GITHUB_API_TOKEN }}
确保使用您的个人访问 token 定义一个 secret POD_GITHUB_API_TOKEN。

关于xcode - 如何使用 GitHub Actions 安装私有(private) Pod?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63662376/

相关文章:

ios - dyld : Library not loaded: @rpath/libswiftCoreLocation. dyli

ios - 无法在 Xcode 10.2 中使用 Cocoapods 分解父类(super class)

c - 使用 Xcode 在 C Bubblesort 中对相同功能的错误访问

ios - Spotify iOS-SDK : Get Tracks from Playlist returns (null) Tracks

ios - TableView Cell 找不到成员 NSNumber 变量

ios - Cocoapods 生成无效的伞头

ios - 无法提取当前用户该操作无法完成。 (NSURLErrorDomain错误-1012

GitHub 自动合并选项未显示在拉取请求中

git - 如何使用不同的用户名推送到 GitHub?

github - 使用目标 ="_blank"在带有 github markdown 的新选项卡中打开链接