mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 10:59:46 +00:00
Added a release command
This commit is contained in:
parent
f02799d050
commit
70610f6e20
@ -16,6 +16,9 @@ public sealed partial class CollectI18NKeysCommand
|
|||||||
if(!Environment.IsWorkingDirectoryValid())
|
if(!Environment.IsWorkingDirectoryValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Console.WriteLine("=========================");
|
||||||
|
Console.Write("- Collecting I18N keys ...");
|
||||||
|
|
||||||
var cwd = Environment.GetAIStudioDirectory();
|
var cwd = Environment.GetAIStudioDirectory();
|
||||||
var binPath = Path.Join(cwd, "bin");
|
var binPath = Path.Join(cwd, "bin");
|
||||||
var objPath = Path.Join(cwd, "obj");
|
var objPath = Path.Join(cwd, "obj");
|
||||||
@ -52,7 +55,8 @@ public sealed partial class CollectI18NKeysCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine($"{counter:###,###} files processed.");
|
Console.WriteLine($" {counter:###,###} files processed.");
|
||||||
|
Console.WriteLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<string> FindAllTextTags(ReadOnlySpan<char> fileContent)
|
private List<string> FindAllTextTags(ReadOnlySpan<char> fileContent)
|
||||||
|
@ -11,9 +11,40 @@ namespace Build.Commands;
|
|||||||
|
|
||||||
public sealed partial class UpdateMetadataCommands
|
public sealed partial class UpdateMetadataCommands
|
||||||
{
|
{
|
||||||
[Command("prepare", Description = "Prepare the next release")]
|
[Command("release", Description = "Prepare & build the next release")]
|
||||||
|
public async Task Release(PrepareAction action)
|
||||||
|
{
|
||||||
|
if(!Environment.IsWorkingDirectoryValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Prepare the metadata for the next release:
|
||||||
|
await this.Prepare(action);
|
||||||
|
|
||||||
|
// Build once to allow the Rust compiler to read the changed metadata
|
||||||
|
// and to update all .NET artifacts:
|
||||||
|
await this.Build();
|
||||||
|
|
||||||
|
// Now, we update the web assets (which may were updated by the first build):
|
||||||
|
new UpdateWebAssetsCommand().UpdateWebAssets();
|
||||||
|
|
||||||
|
// Collect the I18N keys from the source code. This step yields a I18N file
|
||||||
|
// that must be part of the final release:
|
||||||
|
await new CollectI18NKeysCommand().CollectI18NKeys();
|
||||||
|
|
||||||
|
// Build the final release, where Rust knows the updated metadata, the .NET
|
||||||
|
// artifacts are already in place, and .NET knows the updated web assets, etc.:
|
||||||
|
await this.Build();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("prepare", Description = "Prepare the metadata for the next release")]
|
||||||
public async Task Prepare(PrepareAction action)
|
public async Task Prepare(PrepareAction action)
|
||||||
{
|
{
|
||||||
|
if(!Environment.IsWorkingDirectoryValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Console.WriteLine("==============================");
|
||||||
|
Console.WriteLine("- Prepare the metadata for the next release ...");
|
||||||
|
|
||||||
var appVersion = await this.UpdateAppVersion(action);
|
var appVersion = await this.UpdateAppVersion(action);
|
||||||
if (!string.IsNullOrWhiteSpace(appVersion))
|
if (!string.IsNullOrWhiteSpace(appVersion))
|
||||||
{
|
{
|
||||||
@ -27,12 +58,16 @@ public sealed partial class UpdateMetadataCommands
|
|||||||
await this.UpdateProjectCommitHash();
|
await this.UpdateProjectCommitHash();
|
||||||
await this.UpdateLicenceYear(Path.GetFullPath(Path.Combine(Environment.GetAIStudioDirectory(), "..", "..", "LICENSE.md")));
|
await this.UpdateLicenceYear(Path.GetFullPath(Path.Combine(Environment.GetAIStudioDirectory(), "..", "..", "LICENSE.md")));
|
||||||
await this.UpdateLicenceYear(Path.GetFullPath(Path.Combine(Environment.GetAIStudioDirectory(), "Pages", "About.razor.cs")));
|
await this.UpdateLicenceYear(Path.GetFullPath(Path.Combine(Environment.GetAIStudioDirectory(), "Pages", "About.razor.cs")));
|
||||||
|
Console.WriteLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("build", Description = "Build MindWork AI Studio")]
|
[Command("build", Description = "Build MindWork AI Studio")]
|
||||||
public async Task Build()
|
public async Task Build()
|
||||||
{
|
{
|
||||||
|
if(!Environment.IsWorkingDirectoryValid())
|
||||||
|
return;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Build the .NET project:
|
// Build the .NET project:
|
||||||
//
|
//
|
||||||
@ -156,7 +191,10 @@ public sealed partial class UpdateMetadataCommands
|
|||||||
if(foundRustIssue)
|
if(foundRustIssue)
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Console.WriteLine(" completed successfully.");
|
Console.WriteLine(" completed successfully.");
|
||||||
|
Console.WriteLine();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateChangelog(int buildNumber, string appVersion, string buildTime)
|
private async Task UpdateChangelog(int buildNumber, string appVersion, string buildTime)
|
||||||
|
@ -14,13 +14,17 @@ public sealed class UpdateWebAssetsCommand
|
|||||||
if(!Environment.IsWorkingDirectoryValid())
|
if(!Environment.IsWorkingDirectoryValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Console.WriteLine("=========================");
|
||||||
|
Console.Write("- Updating web assets ...");
|
||||||
|
|
||||||
var rid = Environment.GetRidsForCurrentOS().First();
|
var rid = Environment.GetRidsForCurrentOS().First();
|
||||||
var cwd = Environment.GetAIStudioDirectory();
|
var cwd = Environment.GetAIStudioDirectory();
|
||||||
var contentPath = Path.Join(cwd, "bin", "release", Environment.DOTNET_VERSION, rid.ToName(), "publish", "wwwroot", "_content");
|
var contentPath = Path.Join(cwd, "bin", "release", Environment.DOTNET_VERSION, rid.ToName(), "publish", "wwwroot", "_content");
|
||||||
var isMudBlazorDirectoryPresent = Directory.Exists(Path.Join(contentPath, "MudBlazor"));
|
var isMudBlazorDirectoryPresent = Directory.Exists(Path.Join(contentPath, "MudBlazor"));
|
||||||
if (!isMudBlazorDirectoryPresent)
|
if (!isMudBlazorDirectoryPresent)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"No web assets found for RID '{rid}'. Please publish the project first.");
|
Console.WriteLine();
|
||||||
|
Console.WriteLine($"- Error: No web assets found for RID '{rid}'. Please publish the project first.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,6 +43,7 @@ public sealed class UpdateWebAssetsCommand
|
|||||||
File.Copy(sourcePath, targetPath, true);
|
File.Copy(sourcePath, targetPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine($"{counter:###,###} web assets updated successfully.");
|
Console.WriteLine($" {counter:###,###} web assets updated successfully.");
|
||||||
|
Console.WriteLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user