SKILL.md
唯讀
名稱
asc-signing-setup
描述
使用 asc cli 設定 Bundle ID、App 功能權限(Capabilities)、簽署憑證、預備描述檔(Provisioning Profile)以及加密簽署同步。適用於新 App 導入、輪替簽署資產或跨團隊共享簽署檔案等情境。
asc signing setup
當需要為 iOS/macOS 應用程式建立或更新簽署資產時,請使用此 Skill。
前置條件
- 已完成驗證設定(透過
asc auth login或ASC_*環境變數)。 - 已確認 Bundle Identifier 與目標平台。
- 已準備好用於建立憑證的 CSR 檔案,或預計由
asc certificates create --generate-csr自動生成。
工作流程
- 建立或查詢 Bundle ID:
asc bundle-ids list --paginateasc bundle-ids create --identifier "com.example.app" --name "Example" --platform IOS
- 設定 Bundle ID 的功能權限(Capabilities):
asc bundle-ids capabilities list --bundle "BUNDLE_ID"asc bundle-ids capabilities add --bundle "BUNDLE_ID" --capability ICLOUD- 必要時新增功能詳細設定:
--settings '[{"key":"ICLOUD_VERSION","options":[{"key":"XCODE_13","enabled":true}]}]'
- 建立簽署憑證:
asc certificates list --certificate-type IOS_DISTRIBUTIONasc certificates create --certificate-type IOS_DISTRIBUTION --csr "./cert.csr"- 或直接在指令中同步生成私鑰與 CSR:
asc certificates create --certificate-type IOS_DISTRIBUTION --generate-csr --key-out "./signing/dist.key" --csr-out "./signing/dist.csr"
- 建立預備描述檔(Provisioning Profile):
asc profiles create --name "AppStore Profile" --profile-type IOS_APP_STORE --bundle "BUNDLE_ID" --certificate "CERT_ID"- 開發或 Ad-hoc 用途需包含測試裝置:
asc profiles create --name "Dev Profile" --profile-type IOS_APP_DEVELOPMENT --bundle "BUNDLE_ID" --certificate "CERT_ID" --device "DEVICE_ID"
- 下載描述檔:
asc profiles download --id "PROFILE_ID" --output "./profiles/AppStore.mobileprovision"
- 視需求檢視並於本機安裝已下載的描述檔:
asc profiles inspect --path "./profiles/AppStore.mobileprovision" --output tableasc profiles inspect --path "./profiles/AppStore.mobileprovision" --entitlements --output markdownasc profiles local install --path "./profiles/AppStore.mobileprovision"asc profiles local list --output table
輪替與清理
- 撤銷舊憑證:
asc certificates revoke --id "CERT_ID" --confirm
- 刪除或輪替前,先稽核遠端的預備描述檔:
asc profiles list --profile-state ACTIVE,INVALID --paginate --output json- Apple 的
profileState並非完全可靠的過期指標:某些描述檔即使回傳ACTIVE,其expirationDate可能已經過期。若要精確稽核過期的描述檔,請直接比較expirationDate與當前日期,而非僅依賴INVALID狀態。
- 刪除舊描述檔:
asc profiles delete --id "PROFILE_ID" --confirm
- 清理本機 Xcode 的預備描述檔:
asc profiles local clean --expired --dry-runasc profiles local clean --expired --confirm
使用 asc signing sync 進行團隊共享儲存
當你需要一種輕量且非互動式的方式,替代 fastlane match 來將憑證與描述檔加密備份至 Git 時,可使用此功能。
# 將當前 ASC 簽署資產推送到加密的 Git 儲存庫
asc signing sync push \
--bundle-id "com.example.app" \
--profile-type IOS_APP_STORE \
--repo "git@github.com:team/certs.git" \
--password "$MATCH_PASSWORD"
# 拉取並解密至本機目錄
asc signing sync pull \
--repo "git@github.com:team/certs.git" \
--password "$MATCH_PASSWORD" \
--output-dir "./signing"
注意事項:
--password未指定時會自動回退使用ASC_MATCH_PASSWORD。- 加密儲存庫採用類似 match 風格的 Git 目錄結構來存放憑證與描述檔。
pull僅將檔案寫入磁碟;匯入 Keychain 或安裝描述檔為獨立步驟。
注意事項
- 請務必使用
--help確認確切的列舉值(例如憑證類型、描述檔類型)。 - 帳號內資源較多時,請使用
--paginate分頁查詢。 - 若需要多張憑證,
--certificate參數可接收以逗號分隔的 ID。 - 裝置管理請使用
asc devices相關指令(需提供 UDID)。 asc profiles inspect與asc profiles local ...僅操作本機磁碟狀態,不會呼叫 App Store Connect API 資源。






