如何将包发布到 GitHub 包存储库?

How do I publish a package to GitHub Package Repository?

GitHub介绍其Package Registry。它说:

It supports familiar package management tools: JavaScript (npm), Java (Maven), Ruby (RubyGems), .NET (NuGet), and Docker images.

但是我在那里找不到任何关于如何发布新包的文档或示例。我怎样才能做到这一点?

您可能需要 sign up for the beta first. Their docs have commands in various languages - note that GitHub Package Registry 应该使用 language-native 工具将包推送到单独的注册表。

以下是 https://github.com/features/package-registry 中的一些示例。

npm

npm login --registry=https://npm.pkg.github.com --scope=@phanatic
npm publish

RubyGems

echo ":github: Bearer ${GH_TOKEN}" >> ~/.gem/credentials
gem build github_api.gemspec
gem push --key github --host https://rubygems.pkg.github.com/phanatic/github_api github_api-1.0.0.gem

Maven

mvn deploy -Dregistry=https://maven.pkg.github.com/phanatic -Dtoken=$GH_TOKEN

NuGet

nuget source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/phanatic/octokit/index.json" -UserName phanatic
nuget pack
nuget push "octokit.net.1.0.0.nupkg" -Source "GitHub"