xcode-cloud
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseXcode Cloud
Xcode Cloud
Overview
概述
Provide a repeatable setup for Xcode Cloud custom scripts, with ready-to-copy templates for XcodeGen generation and post-archive Git tagging.
提供Xcode Cloud自定义脚本的可重复设置方案,附带可直接复制的XcodeGen生成及归档后Git标签推送模板。
Quick Start
快速开始
- Identify the folder that contains the or
.xcodeproj..xcworkspace - Check whether the /
.xcodeprojis tracked in git. If it is generated and ignored, you must use.xcworkspace(or commit the generated project).ci_post_clone.sh - Create in that folder if missing.
ci_scripts/ - Copy templates from .
assets/ - Customize variables noted in the templates.
- .
chmod +x ci_scripts/*.sh - In Xcode Cloud, add required secrets (for tagging) and ensure an Archive action exists.
- 找到包含或
.xcodeproj的文件夹。.xcworkspace - 检查/
.xcodeproj是否已被git追踪。如果它是生成的且被忽略,则必须使用.xcworkspace(或提交生成的项目)。ci_post_clone.sh - 如果缺少文件夹,在该目录下创建它。
ci_scripts/ - 从中复制模板文件。
assets/ - 自定义模板中标记的变量。
- 执行。
chmod +x ci_scripts/*.sh - 在Xcode Cloud中添加所需的密钥(用于标签推送),并确保存在Archive操作。
Workflow: XcodeGen + Tagging
工作流:XcodeGen + 标签推送
1) Place scripts where Xcode Cloud expects them
1) 将脚本放置在Xcode Cloud期望的位置
Create at the same level as the /. Xcode Cloud only recognizes the three official filenames; use (or ) for XcodeGen and for tagging.
ci_scripts/.xcodeproj.xcworkspaceci_pre_xcodebuild.shci_post_clone.shci_post_xcodebuild.sh在与/同级的目录下创建。Xcode Cloud仅识别三个官方文件名;使用(或)来处理XcodeGen,使用来处理标签推送。
.xcodeproj.xcworkspaceci_scripts/ci_pre_xcodebuild.shci_post_clone.shci_post_xcodebuild.sh2) XcodeGen project generation
2) XcodeGen项目生成
Use if your / is generated and not committed.
Xcode Cloud validates the project path and schemes before runs, so
pre-xcodebuild is too late in that setup.
Copy to .
Use only when the project already exists in the repo.
Adjust the root detection if your is not at repo root.
ci_post_clone.sh.xcodeproj.xcworkspaceci_pre_xcodebuild.shassets/ci_post_clone.shci_scripts/ci_post_clone.shci_pre_xcodebuild.shproject.yml如果你的/是生成的且未提交,请使用。
Xcode Cloud会在运行前验证项目路径和scheme,因此在这种设置下,pre-xcodebuild的时机太晚。
将复制到。
仅当项目已存在于仓库中时,才使用。
如果你的不在仓库根目录,请调整根目录检测逻辑。
.xcodeproj.xcworkspaceci_post_clone.shci_pre_xcodebuild.shassets/ci_post_clone.shci_scripts/ci_post_clone.shci_pre_xcodebuild.shproject.yml3) Tagging after successful archives
3) 成功归档后推送标签
Copy to .
Set (or provide it as an Xcode Cloud env var).
Set if you want a custom prefix.
Ensure the workflow includes an Archive action; otherwise the script will no-op.
Add as a secret environment variable in Xcode Cloud.
assets/ci_post_xcodebuild.shci_scripts/ci_post_xcodebuild.shINFO_PLIST_PATHTAG_PREFIXGITHUB_TOKEN将复制到。
设置(或通过Xcode Cloud环境变量提供)。
如果需要自定义前缀,请设置。
确保工作流包含Archive操作;否则脚本将不执行任何操作。
在Xcode Cloud中添加作为保密环境变量。
assets/ci_post_xcodebuild.shci_scripts/ci_post_xcodebuild.shINFO_PLIST_PATHTAG_PREFIXGITHUB_TOKEN4) Make scripts executable
4) 使脚本可执行
Run after adding or editing scripts.
chmod +x ci_scripts/*.sh添加或编辑脚本后,执行。
chmod +x ci_scripts/*.shTemplate Assets
模板资源
- : XcodeGen install + project generation (two-script setup)
assets/ci_pre_xcodebuild.sh - : XcodeGen install + project generation (alternative)
assets/ci_post_clone.sh - : archive-only tag push using
assets/ci_post_xcodebuild.shGITHUB_TOKEN
- :XcodeGen安装 + 项目生成(双脚本设置)
assets/ci_pre_xcodebuild.sh - :XcodeGen安装 + 项目生成(替代方案)
assets/ci_post_clone.sh - :使用
assets/ci_post_xcodebuild.sh仅在归档后推送标签GITHUB_TOKEN
Notes
注意事项
- Use the skill when you need official Apple documentation on Xcode Cloud behavior or environment variables.
apple-docs-research - Keep logs free of secrets; use Xcode Cloud secret environment variables for tokens.
- Reference for quick reminders about doc lookups.
references/xcode-cloud-notes.md - If you see , Xcode Cloud validated the project before your script ran. Fix by switching to
Project <Name>.xcodeproj does not exist at <path>or committing the generated project.ci_post_clone.sh
- 当你需要关于Xcode Cloud行为或环境变量的官方Apple文档时,请使用技能。
apple-docs-research - 日志中不要包含敏感信息;使用Xcode Cloud保密环境变量来存储令牌。
- 参考获取文档查询的快速提示。
references/xcode-cloud-notes.md - 如果看到错误,说明Xcode Cloud在你的脚本运行前就验证了项目。请切换到
Project <Name>.xcodeproj does not exist at <path>或提交生成的项目来修复该问题。ci_post_clone.sh