diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index a7c8e64..9d0681c 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -18,6 +18,10 @@ "type": "string", "description": "PackageName" }, + "PackageListingSuffix": { + "type": "string", + "description": "Suffix to append to the listing package name and ID" + }, "Help": { "type": "boolean", "description": "Shows the help text for this build assembly" @@ -113,4 +117,4 @@ } } } -} \ No newline at end of file +} diff --git a/PackageBuilder/Build.cs b/PackageBuilder/Build.cs index 7b50690..30e8581 100644 --- a/PackageBuilder/Build.cs +++ b/PackageBuilder/Build.cs @@ -53,13 +53,22 @@ partial class Build : NukeBuild ? RootDirectory.Parent : RootDirectory.Parent / "template-package-listing"; + private string _currentListingUrl; [Parameter("Path to existing index.json file, typically https://{owner}.github.io/{repo}/index.json")] - string CurrentListingUrl => - $"https://{GitHubActions.RepositoryOwner}.github.io/{GitHubActions.Repository.Split('/')[1]}/{PackageListingPublishFilename}"; + public string CurrentListingUrl + { + get => _currentListingUrl ?? + $"https://{GitHubActions.RepositoryOwner}.github.io/{GitHubActions.Repository.Split('/')[1]}/{PackageListingPublishFilename}"; + + set => _currentListingUrl = value; + } // assumes that "template-package" repo is checked out in sibling dir to this repo, can be overridden [Parameter("Path to Target Package")] AbsolutePath LocalTestPackagesPath => RootDirectory.Parent / "template-package" / "Packages"; + + [Parameter("Suffix to append to the listing package name and ID")] + string PackageListingSuffix = "Listing"; AbsolutePath PackageListingSourcePath => PackageListingSourceFolder / PackageListingSourceFilename; AbsolutePath WebPageSourcePath => PackageListingSourceFolder / "Website"; @@ -84,8 +93,12 @@ ListingSource MakeListingSourceFromManifest(VRCPackageManifest manifest) { var result = new ListingSource() { - name = $"{manifest.displayName} Listing", - id = $"{manifest.name}.listing", + name = !string.IsNullOrWhiteSpace(PackageListingSuffix) + ? $"{manifest.displayName} {PackageListingSuffix}" + : $"{manifest.displayName}", + id = !string.IsNullOrWhiteSpace(PackageListingSuffix) + ? $"{manifest.name}.{PackageListingSuffix.ToLower()}" + : $"{manifest.name}", author = new VRC.PackageManagement.Automation.Multi.Author() { name = manifest.author.name ?? "", @@ -466,4 +479,4 @@ static HttpClient Http }, }; } -} \ No newline at end of file +}