From d5ccfd9651fb792cdcc8fba33874badde9c399f8 Mon Sep 17 00:00:00 2001 From: leo12025 Date: Sat, 27 Dec 2025 23:08:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20PowerBar=20?= =?UTF-8?q?=E7=9A=84=E6=9E=84=E5=BB=BA=E8=84=9A=E6=9C=AC=E7=94=A8=E4=BA=8E?= =?UTF-8?q?=E6=89=93=E5=8C=85=E5=92=8C=E5=AF=BC=E5=87=BA=E5=BA=94=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archive_export.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 archive_export.sh diff --git a/archive_export.sh b/archive_export.sh new file mode 100755 index 0000000..e21e6fe --- /dev/null +++ b/archive_export.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# PowerBar 构建脚本 +# 使用 archive + export 方式构建应用 + +set -e + +echo "=== PowerBar 构建脚本 ===" + +echo "1. 清理之前的构建产物..." +# 清理之前的构建产物 +rm -rf build +rm -rf archive +rm -rf PowerBar.app +rm -rf PowerBar-*.dmg + +echo "2. 创建构建目录..." +mkdir -p build +mkdir -p archive + +echo "3. 归档项目..." +xcodebuild archive \ + -project PowerBar.xcodeproj \ + -scheme PowerBar \ + -archivePath archive/PowerBar.xcarchive \ + -destination 'generic/platform=macOS' \ + -configuration Release + +echo "4. 导出归档..." +xcodebuild -exportArchive -archivePath archive/PowerBar.xcarchive -exportPath build -exportOptionsPlist ExportOptions.plist + +echo "5. 复制应用到当前目录..." +cp -R build/PowerBar.app . + +echo "6. 创建DMG安装包..." +# 获取当前版本号 +VERSION=$(xcodebuild -project PowerBar.xcodeproj -showBuildSettings | grep MARKETING_VERSION | head -1 | awk -F'=' '{print $2}' | xargs) + +# 创建DMG +hdiutil create -volname "PowerBar" \ + -srcfolder PowerBar.app \ + -ov \ + -format UDZO \ + PowerBar-$VERSION.dmg + +echo "7. 构建完成!" +echo "应用:$(pwd)/PowerBar.app" +echo "DMG:$(pwd)/PowerBar-$VERSION.dmg" +echo "=== 构建脚本执行结束 ===" \ No newline at end of file