macos-spm-app-packaging
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesemacOS SwiftPM App Packaging (No Xcode)
macOS SwiftPM App Packaging (No Xcode)
Overview
概述
Bootstrap a complete SwiftPM macOS app folder, then build, package, and run it without Xcode. Use for the starter layout and + for packaging and release details.
assets/templates/bootstrap/references/packaging.mdreferences/release.md无需Xcode,即可快速搭建完整的SwiftPM macOS应用文件夹,然后进行构建、打包和运行。使用获取初始布局,参考和了解打包和发布细节。
assets/templates/bootstrap/references/packaging.mdreferences/release.mdTwo-Step Workflow
两步工作流程
-
Bootstrap the project folder
- Copy into a new repo.
assets/templates/bootstrap/ - Rename in
MyApp,Package.swift, andSources/MyApp/.version.env - Customize ,
APP_NAME, and versions.BUNDLE_ID
- Copy
-
Build, package, and run the bootstrapped app
- Copy scripts from into your repo (for example,
assets/templates/).Scripts/ - Build/tests: and
swift build.swift test - Package: .
Scripts/package_app.sh - Run: (preferred) or
Scripts/compile_and_run.sh.Scripts/launch.sh - Release (optional): and
Scripts/sign-and-notarize.sh.Scripts/make_appcast.sh - Tag + GitHub release (optional): create a git tag, upload the zip/appcast to the GitHub release, and publish.
- Copy scripts from
-
搭建项目文件夹
- 将复制到新仓库中。
assets/templates/bootstrap/ - 在、
Package.swift和Sources/MyApp/中重命名version.env。MyApp - 自定义、
APP_NAME和版本信息。BUNDLE_ID
- 将
-
构建、打包并运行已搭建的应用
- 将中的脚本复制到你的仓库中(例如
assets/templates/目录)。Scripts/ - 构建/测试:执行和
swift build。swift test - 打包:执行。
Scripts/package_app.sh - 运行:执行(推荐)或
Scripts/compile_and_run.sh。Scripts/launch.sh - 发布(可选):执行和
Scripts/sign-and-notarize.sh。Scripts/make_appcast.sh - 打标签+GitHub发布(可选):创建git标签,将zip包/应用更新提要上传到GitHub发布页,然后发布。
- 将
Templates
模板
- : Build binaries, create the .app bundle, copy resources, sign.
assets/templates/package_app.sh - : Dev loop to kill running app, package, launch.
assets/templates/compile_and_run.sh - : Generate .icns from an Icon Composer file (requires Xcode install).
assets/templates/build_icon.sh - : Notarize, staple, and zip a release build.
assets/templates/sign-and-notarize.sh - : Generate Sparkle appcast entries for updates.
assets/templates/make_appcast.sh - : Create a stable dev code-signing identity.
assets/templates/setup_dev_signing.sh - : Simple launcher for a packaged .app.
assets/templates/launch.sh - : Example version file consumed by packaging scripts.
assets/templates/version.env - : Minimal SwiftPM macOS app skeleton (Package.swift, Sources/, version.env).
assets/templates/bootstrap/
- :构建二进制文件、创建.app包、复制资源、签名。
assets/templates/package_app.sh - :开发循环脚本,用于终止运行中的应用、打包、启动应用。
assets/templates/compile_and_run.sh - :从Icon Composer文件生成.icns图标(需要安装Xcode)。
assets/templates/build_icon.sh - :对发布版本进行公证、装订并压缩。
assets/templates/sign-and-notarize.sh - :为更新生成Sparkle应用更新提要条目。
assets/templates/make_appcast.sh - :创建稳定的开发代码签名身份。
assets/templates/setup_dev_signing.sh - :用于启动已打包.app的简单启动器。
assets/templates/launch.sh - :供打包脚本读取的示例版本文件。
assets/templates/version.env - :极简SwiftPM macOS应用骨架(包含Package.swift、Sources/、version.env)。
assets/templates/bootstrap/
Notes
注意事项
- Keep entitlements and signing configuration explicit; edit the template scripts instead of reimplementing.
- Remove Sparkle steps if you do not use Sparkle for updates.
- Sparkle relies on the bundle build number (), so
CFBundleVersioninBUILD_NUMBERmust increase for each update.version.env - For menu bar apps, set when packaging to emit
MENU_BAR_APP=1in Info.plist.LSUIElement
- 明确保留权限和签名配置;编辑模板脚本而非重新实现。
- 如果你不使用Sparkle进行更新,请移除相关步骤。
- Sparkle依赖于包构建编号(),因此
CFBundleVersion中的version.env必须在每次更新时递增。BUILD_NUMBER - 对于菜单栏应用,打包时设置,以在Info.plist中添加
MENU_BAR_APP=1。LSUIElement