【发布时间】:2020-01-13 07:52:55
【问题描述】:
我正在尝试使用 GitHub 操作从我的项目生成 NuGet 包并将其推送到(私有)GitHub 注册表。
我的脚本([NAME] 字段已编辑):
name: Update NuGet
on: [push]
jobs:
build:
runs-on: ubuntu-latest
name: Update NuGet
steps:
- uses: actions/checkout@master
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '2.2.105'
- name: Package Release
run: |
cd [SOLUTION_FOLDER]
dotnet pack -c Release -o out
- name: Publish Nuget to GitHub registry
run: dotnet nuget push ./[SOLUTION_FOLDER]/[PROJECT_FOLDER]/out/$(ls ./[SOLUTION_FOLDER]/[PROJECT_FOLDER]/out) -s https://nuget.pkg.github.com/[USERNAME]/index.json -k ${GITHUB_TOKEN}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
日志输出:
info : Pushing [PROJECT_FOLDER].3.4.23.nupkg to 'https://nuget.pkg.github.com/[USERNAME]'...
info : PUT https://nuget.pkg.github.com/[USERNAME]/
info : An error was encountered when fetching 'PUT https://nuget.pkg.github.com/[USERNAME]/'. The request will now be retried.
info : An error occurred while sending the request.
info : The server returned an invalid or unrecognized response.
info : PUT https://nuget.pkg.github.com/[USERNAME]/
info : An error was encountered when fetching 'PUT https://nuget.pkg.github.com/[USERNAME]/'. The request will now be retried.
info : An error occurred while sending the request.
info : The server returned an invalid or unrecognized response.
info : PUT https://nuget.pkg.github.com/[USERNAME]/
error: An error occurred while sending the request.
error: The server returned an invalid or unrecognized response.
##[error]Process completed with exit code 1.
这是对应的 GitHub 问题(带有解决方法选项):https://github.com/NuGet/Home/issues/8580
【问题讨论】:
-
请添加关于您如何使用
dotnet nuget push命令修复error: Please specify the path to the package.的说明。 -
@Konard 那是我的错。我没有在 env var 中获得文件名。我通过直接添加命令来解决它
dotnet nuget push /path/$(ls ..) -
你设法让它工作了吗?我正在尝试同样的事情,但很挣扎。
-
@JustusBurger 我正在联系 GitHub 支持。如果他们可以帮助我解决它,我会发布答案。
-
为什么不使用Publish NuGet Action?
标签: bash github nuget github-actions