As far as I know a PowerShell repository is a NuGet repository...
GitHub just released their package registry, which my company currently uses for npm, but also has an endpoint for NuGet.
I can access the NuGet endpoint (https://nuget.pkg.github.com/mycompany/index.json) with my GitHub credential, which returns a valid json:
{
"version": "3.0.0-beta.1",
"resources": [
{
"@id": "https://nuget.pkg.github.com/mycompany/download",
"@type": "PackageBaseAddress/3.0.0",
"comment": "Get package content (.nupkg)."
},
{
"@id": "https://nuget.pkg.github.com/mycompany/query",
"@type": "SearchQueryService",
"comment": "Filter and search for packages by keyword."
},
{
"@id": "https://nuget.pkg.github.com/mycompany/query",
"@type": "SearchQueryService/3.0.0-beta",
"comment": "Filter and search for packages by keyword."
},
{
"@id": "https://nuget.pkg.github.com/mycompany/query",
"@type": "SearchQueryService/3.0.0-rc",
"comment": "Filter and search for packages by keyword."
},
{
"@id": "https://nuget.pkg.github.com/mycompany",
"@type": "PackagePublish/2.0.0",
"comment": "Push and delete (or unlist) packages."
},
{
"@id": "https://nuget.pkg.github.com/mycompany",
"@type": "RegistrationsBaseUrl",
"comment": "Get package metadata."
},
{
"@id": "https://nuget.pkg.github.com/mycompany",
"@type": "RegistrationsBaseUrl/3.0.0-beta",
"comment": "Get package metadata."
},
{
"@id": "https://nuget.pkg.github.com/mycompany",
"@type": "RegistrationsBaseUrl/3.0.0-rc",
"comment": "Get package metadata."
}
]
}
I've been trying to use this to set it up as a repo on my local machine (before I'd ideally push modules on my CI/CD and make them available for people to Install-Module
using GitHub as a repo):
PS C:> $gitHubCredential = Get-Credential
PS C:> (iwr https://nuget.pkg.github.com/mycompany/index.json -Credential $gitHubCredential).StatusCode
200
PS C:> Register-PSRepository -Name GitHub -SourceLocation https://nuget.pkg.github.com/mycompany -PublishLocation https://nuget.pkg.github.com/mycompany -Credential $gitHubCredential
Register-PSRepository : The specified Uri 'https://nuget.pkg.github.com/mycompany' for parameter 'SourceLocation' is
an invalid Web Uri. Please ensure that it meets the Web Uri requirements.
At line:1 char:1
+ Register-PSRepository -Name GitHub -SourceLocation https://nuget.pkg. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (https://nuget.pkg.github.com/mycompany:String) [Register-PSRepository
], ArgumentException
+ FullyQualifiedErrorId : InvalidWebUri,Register-PSRepository
Am I trying something impossible?