mcpField
A
asc-appstore-release

asc-appstore-release

github.com/tddworks云与 DevOps591 次安装5 周前更新
代码仓库

关于 asc-appstore-release

使用 `asc` 命令行在 GitHub Actions 中自动发布 App Store 版本的技能。涵盖从源码构建并上传,或上传预构建 IPA/PKG,以及管理 TestFlight 和提交检查。

主要功能

  1. 01从源码构建、导出并上传
  2. 02上传预构建 IPA 或 PKG
  3. 03将构建版本加入 TestFlight 群组
  4. 04设置测试版发布说明
  5. 05检查就绪状态并提交版本

适用场景

  1. 01在 GitHub Actions 中自动发布 App Store 版本
  2. 02上传已签名的 iOS 或 macOS 构建产物
  3. 03通过 TestFlight 分发构建版本
  4. 04提交含应用内购买项目的版本

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/tddworks/asc-cli-skills --skill asc-appstore-release

安装后在 Claude Code 中输入/asc-appstore-release确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

.DS_Store
references/
workflow-template.md
scripts/
setup-mas-certs.sh

详细介绍

使用 GitHub Actions 和 asc 发布到 App Store

根据构建设置,有两种方式:

选项 A:从源代码归档 — asc 处理所有步骤(归档 + 导出 + 上传)

Xcode project
  → asc builds next-number            # auto-resolve build number
  → asc builds archive --upload        # archive, export, upload in one step
  → asc builds add-beta-group          # optional: TestFlight distribution
  → asc builds update-beta-notes       # optional: "What's New" text
  → asc versions set-build             # link build to App Store version
  → asc versions check-readiness       # gate: verify all checks pass
  → asc versions submit                # submit for App Store review (--with-products for new IAPs/subscriptions)

选项 B:上传预构建的 IPA — 你已有已签名的二进制文件(来自 Xcode、Fastlane 等)

Signed IPA/PKG (from your build step)
  → asc builds next-number            # auto-resolve build number
  → asc builds upload --wait           # upload + wait for Apple processing
  → asc builds add-beta-group          # optional: TestFlight distribution
  → asc builds update-beta-notes       # optional: "What's New" text
  → asc versions set-build             # link build to App Store version
  → asc versions check-readiness       # gate: verify all checks pass
  → asc versions submit                # submit for App Store review (--with-products for new IAPs/subscriptions)

完整的可直接复制粘贴的工作流,请参阅 workflow-template.md。

设置 Mac App Store 证书

首次运行 CI 之前,你需要准备 APPLE_MAS_CERTIFICATE_P12 和 APPLE_MAS_CERTIFICATE_PASSWORD。 运行交互式设置脚本:

.claude/skills/asc-appstore-release/scripts/setup-mas-certs.sh

该脚本会引导你了解完整的工作原理:

Generate CSR
  → asc certificates create MAC_APP_DISTRIBUTION  (automated)
  → Apple portal: Mac Installer Distribution cert  (one browser step)
  → Export both as P12 via Keychain Access
  → Print base64 values ready to paste into GitHub Secrets

在 GitHub Actions 中安装 asc

- name: Install asc CLI
  run: |
    brew tap tddworks/tap
    brew install asccli

或者直接下载特定版本:

- name: Install asc CLI
  run: |
    VERSION="0.1.3"
    ARCH=$(uname -m | sed 's/x86_64/x86_64/;s/arm64/arm64/')
    curl -sL "https://github.com/tddworks/asc-cli/releases/download/v${VERSION}/asc_${VERSION}_macOS_${ARCH}" \
      -o /usr/local/bin/asc && chmod +x /usr/local/bin/asc

身份验证设置

asc 会自动从环境变量中读取凭据:

env:
  ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
  ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
  ASC_PRIVATE_KEY: ${{ secrets.ASC_PRIVATE_KEY }}   # PEM content, NOT a path

所需的 GitHub Secrets:

Secret值
ASC_KEY_IDApp Store Connect API Key ID(例如 6X3CMK22CY)
ASC_ISSUER_IDIssuer ID(UUID 格式)
ASC_PRIVATE_KEY.p8 文件的完整 PEM 内容

从 .p8 文件中获取 PEM 内容:

cat AuthKey_XXXXXX.p8 | pbcopy   # paste as the secret value

核心命令

选项 A:从源代码归档(推荐用于仅使用 asc 的工作流)
# 1. Get the next build number
BUILD_NUMBER=$(asc builds next-number --app-id $APP_ID --version $VERSION --platform ios)

# 2. Archive, export, and upload in one command
asc builds archive \
  --scheme $SCHEME \
  --platform ios \
  --upload \
  --app-id $APP_ID \
  --version $VERSION \
  --build-number $BUILD_NUMBER

# 3. Get the processed build ID
BUILD_ID=$(asc builds list --app-id $APP_ID --version $VERSION --platform ios | jq -r '.data[0].id')
选项 B:上传预构建的 IPA/PKG
# 1. Get the next build number
BUILD_NUMBER=$(asc builds next-number --app-id $APP_ID --version $VERSION --platform ios)

# 2. Upload IPA (auto-detects iOS from .ipa, macOS from .pkg)
asc builds upload \
  --app-id $APP_ID \
  --file MyApp.ipa \
  --version $VERSION \
  --build-number $BUILD_NUMBER \
  --wait

# 3. Get the processed build ID
BUILD_ID=$(asc builds list --app-id $APP_ID --version $VERSION --platform ios | jq -r '.data[0].id')
通用步骤(任一选项之后)
# 4. TestFlight: add to beta group
asc builds add-beta-group --build-id $BUILD_ID --beta-group-id $GROUP_ID

# 5. TestFlight: set "What's New" notes
asc builds update-beta-notes \
  --build-id $BUILD_ID \
  --locale en-US \
  --notes "Bug fixes and improvements."

# 6. App Store: link build to version
VERSION_ID=$(asc versions list --app-id $APP_ID --pretty | jq -r '.data[0].id')
asc versions set-build --version-id $VERSION_ID --build-id $BUILD_ID

# 7. App Store: gate — verify all checks pass before submitting
READINESS=$(asc versions check-readiness --version-id $VERSION_ID)
IS_READY=$(echo "$READINESS" | jq -r '.data[0].isReadyToSubmit')
if [ "$IS_READY" != "true" ]; then
  echo "Version is NOT ready to submit:"
  echo "$READINESS" | jq '.data[0] | {stateCheck, buildCheck, pricingCheck}'
  exit 1
fi

# 8. App Store: submit for review. --with-products also sends every READY_TO_SUBMIT
#    in-app purchase and subscription in the same submission — required for first-time
#    products, harmless otherwise. Preview with --dry-run.
asc versions submit --version-id $VERSION_ID --with-products

首次提交的 IAP 和订阅必须与某个 App 版本一同接受审核;关于试运行、逐步控制和查看 Apple 拒绝原因,请参阅 submit-with-products.md。

查找 ID

# App ID (do this once, store as a secret or env var)
asc apps list --pretty | jq -r '.data[] | "\(.name): \(.id)"'

# Beta group ID
asc testflight groups list --app-id $APP_ID --pretty | jq -r '.data[0].id'

# Current version ID (latest editable version)
asc versions list --app-id $APP_ID --pretty | jq -r '.data[0].id'

评论

支持 Markdown