文档不完整,目前我无法在 Mac 上使用 dotnet 使用或发布包到 GPR。任何帮助都会很有用
问问题
2783 次
3 回答
4
远非理想,我还没有在 Mac 上测试过,但它可以在 Linux 上运行
发布
- 在您的 GitBHub 设置中启用 GPR '功能'
- 转到 github 并添加一个具有 GPR 读/写访问权限的 TOKEN
在本地添加源
nuget source Add -Name "GitHub" \ -Source "https://nuget.pkg.github.com/MY_ACCOUNT/index.json"
设置 api 密钥
nuget setApiKey $TOKEN \ -Source "https://nuget.pkg.github.com/MY_ACCOUNT/index.json"
推送包
nuget push "my.lib.nupkg" -Source "GitHub"
安装包
nuget install my.lib -pre # '-pre' because of alpha, if alpha
笔记: 'nuget install' 下载 nuget 包 它不会将其添加到项目中。 'dotnet' 找不到 无论如何都要这样做,这样它就会被缓存在`~/.nuget/packages`中 可以删除`./project`相关下载包
手动参考:
将“新源”添加到 nuget.config。
<add key="GitHub" value="https://nuget.pkg.github.com/MY_ACCOUNT/index.json" />
nuget配置可以
- './nuget.config'
- '~/.nuget/NuGet/nuget.config'
添加到项目:
dotnet add package my.lib \
-v 1.0.0-alpha \
-n # don't download, it can't handle authentication
或者:
编辑项目包参考
<PackageReference Include="my.lib" Version="1.0.0-alpha" />
最后:
dotnet restore
于 2019-10-20T07:06:01.667 回答
2
您必须自己进行 HTTP 调用(为简洁起见,省略了其他步骤):
jobs:
continuous-integration:
runs-on: ubuntu-latest
steps:
- name: push
run: |
for f in ./packages/*.nupkg
do
curl -vX PUT -u "<YOUR USER NAME>:${{ secrets.GITHUB_TOKEN }}" -F package=@$f https://nuget.pkg.github.com/<YOUR USER NAME>/
done
if: github.event_name == 'push'
于 2019-12-16T09:30:52.480 回答
2
正如您在 github 社区问题的此链接中看到的,GPR 目前不支持 dotnet nuget,您必须将 nuget 与 Mono 一起使用或从 Windows 发布。
我希望他们能在不久的将来自己修复它,这完全阻止了我利用 GPR。
于 2019-10-18T10:03:39.813 回答