Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make package listing suffix configurable and the URL configurable #29

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -113,4 +117,4 @@
}
}
}
}
}
23 changes: 18 additions & 5 deletions PackageBuilder/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Comment on lines +56 to +64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just meant to be used by passing parameters to the nuke Target call directly, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, I would actually like to switch it back to being determined entirely at runtime, but I cant seem to find a way currently to get the actual domain setup of the user

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about just keeping it simple and grabbing the location in the javascript and tacking index.json to the end?

const packageUrl = `${window.location.host}${window.locationpathname}/index.json`;

not the most elegant but would probably get the job done

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind, i see the listing url is needed at build time after the first deployment now


// 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";
Expand All @@ -84,8 +93,12 @@ ListingSource MakeListingSourceFromManifest(VRCPackageManifest manifest)
{
var result = new ListingSource()
{
name = $"{manifest.displayName} Listing",
id = $"{manifest.name}.listing",
name = PackageListingSuffix != ""
? $"{manifest.displayName} {PackageListingSuffix}"
: $"{manifest.displayName}",
id = PackageListingSuffix != ""
Happyrobot33 marked this conversation as resolved.
Show resolved Hide resolved
? $"{manifest.name}.{PackageListingSuffix.ToLower()}"
: $"{manifest.name}",
author = new VRC.PackageManagement.Automation.Multi.Author()
{
name = manifest.author.name ?? "",
Expand Down Expand Up @@ -466,4 +479,4 @@ static HttpClient Http
},
};
}
}
}
Loading