static void MakePackage() { string packagePath = MouseSelector.GetSelectedPathOrFallback(); string packageConfigPath = Path.Combine(packagePath, "Package.assets"); PackageConfig packageConfig = null; if (File.Exists(packageConfigPath)) { packageConfig = PackageConfig.LoadFromPath(packageConfigPath); packageConfig.PackagePath = packagePath; } else { packageConfig = new PackageConfig(packagePath); } packageConfig.SaveLocal(); }
static void UploadPackage() { string packagePath = MouseSelector.GetSelectedPathOrFallback(); string packageConfigPath = packagePath.EndsWith(".asset") ? packagePath : packagePath.Append(".asset").ToString(); if (File.Exists(packageConfigPath)) { string err = string.Empty; PackageConfig config = PackageConfig.LoadFromPath(packageConfigPath); string serverUploaderPath = Application.dataPath.CombinePath(config.PackageServerGitUrl.GetLastWord()); if (!Directory.Exists(serverUploaderPath)) { RunCommand(string.Empty, "git clone ".Append(config.PackageServerGitUrl).ToString()); } ZipUtil.ZipDirectory(config.PackagePath, IOUtils.CreateDirIfNotExists(serverUploaderPath.CombinePath(config.Name)).CombinePath(config.Name + ".zip")); PackageListConfig .MergeGitClonedPackageList(config) .SaveExport(config.PackageServerGitUrl); RunCommand(config.PackageServerGitUrl.GetLastWord(), string.Format( "git add . && git commit -m \"{0}\" && git push", config.ReleaseNote.IsNullOrEmpty() ? "no release note" : config.Name.Append(" ").Append(config.Version).AppendFormat(" {0}", config.ReleaseNote).ToString())); RunCommand(string.Empty, "rm -rf " + config.PackageServerGitUrl.GetLastWord()); AssetDatabase.Refresh(); Application.OpenURL(config.PackageServerGitUrl); } else { Log.W("no package.json file in folder:{0}", packagePath); } }