diff --git a/Editor/BuildTool/AppBuildParam.cs b/Editor/BuildTool/AppBuildParam.cs
index b82d1a7..eb6443d 100644
--- a/Editor/BuildTool/AppBuildParam.cs
+++ b/Editor/BuildTool/AppBuildParam.cs
@@ -32,6 +32,9 @@ namespace Guru.Editor
public string IOSTargetVersion = ""; // IOS SDK 版本设置 ( iOS 发布专用 )
public string IOSTeamId = ""; // IOS 打包 TeamId ( iOS 使用专用的开发证书后开启 )
public string CompanyName = ""; // 发布厂商的名称
+ //------------ Publish -------------
+ public bool AutoPublish = false;
+ public string PgyerAPIKey = "";
diff --git a/Editor/BuildTool/AppBuilder.cs b/Editor/BuildTool/AppBuilder.cs
index 398b7f9..ca2b345 100644
--- a/Editor/BuildTool/AppBuilder.cs
+++ b/Editor/BuildTool/AppBuilder.cs
@@ -119,7 +119,11 @@ namespace Guru.Editor
{
Open(outputDir);
}
-
+
+ if (buildParam.AutoPublish)
+ {
+ GuruPublishHelper.Publish(apkPath, buildParam.PgyerAPIKey); // 直接发布版本
+ }
return apkPath;
}
diff --git a/Editor/BuildTool/GuruPublishHelper.cs b/Editor/BuildTool/GuruPublishHelper.cs
index 22b2ac4..b3456f2 100644
--- a/Editor/BuildTool/GuruPublishHelper.cs
+++ b/Editor/BuildTool/GuruPublishHelper.cs
@@ -202,8 +202,12 @@ namespace Guru.Editor
// SelectAndPublish("aab");
// }
-
- public static void SelectAndPublish(string extension = "apk", string apiKey = "")
+ ///
+ /// 直接发布版本
+ ///
+ ///
+ ///
+ public static void Publish(string appPath, string apiKey = "")
{
string bash_path = EvnCheck();
if (string.IsNullOrEmpty(bash_path))
@@ -211,16 +215,25 @@ namespace Guru.Editor
ShowDialog("找不到 Bash 执行文件", $"Bash文件不存在: {bash_path}!");
return;
}
-
- string file = EditorUtility.OpenFilePanel("选择包体", $"~/Downloads", extension);
-
- if (!File.Exists(file))
+ if (!File.Exists(appPath))
{
- ShowDialog("找不到包体文件", $"包体文件不存在: {file}!");
+ ShowDialog("找不到包体文件", $"包体文件不存在: {appPath}!");
return;
}
- PgyerAPI.PublishToPgyer(file, apiKey, bash_path, OnResponse);
+ PgyerAPI.PublishToPgyer(appPath, apiKey, bash_path, OnResponse);
+
+ }
+
+ ///
+ /// 选择文件及发布版本
+ ///
+ ///
+ ///
+ public static void SelectAndPublish(string extension = "apk", string apiKey = "")
+ {
+ string file = EditorUtility.OpenFilePanel("选择包体", $"~/Downloads", extension);
+ Publish(file, apiKey);
}
///