github - 尝试通过 GitHubActions 发布到 GitHub 包时出现不正确的路径和无 API 错误
问题描述
一直卡在这个问题上,似乎是一个接一个的问题,只是试图让 GitHub Actions 将一个 nuGet 包发布到 GitHub 包,文档真的很难找到,似乎没有给出任何明确的例子
这是我之前的问题(只是为了上下文以防它有帮助) 我无法获得 gitHub 操作来将我的包构建发布到 nuget.pkg.github
但现在,我得到以下信息:
Run dotnet nuget push "bin/Release/Project.1.0.0.nupkg" --source "github"
warn : No API Key was provided and no API Key could be found for 'https://nuget.pkg.github.com/name'. To save an API Key for a source use the 'setApiKey' command.
error: Could not find a part of the path '/home/runner/work/project/project/bin/Release'.
这是我的完整 yml
name: .NET Core
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.200
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
- name: nuGet publish
run: dotnet nuget add source https://nuget.pkg.github.com/name/index.json -n github -u uname -p password123 --store-password-in-clear-text
- name: nuGet pack
run: dotnet pack --configuration Release
- name: publish
run: dotnet nuget push "bin/Release/EurekaShared.1.0.0.nupkg" --source "github"
这是构建结果:
解决方案
dotnet nuget
遗憾的是并不总是按预期工作,并且有返回误导性错误消息的习惯。真让人生气。
尝试nuget/setup-nuget@v1
在您的工作流程中添加一个步骤并使用nuget.exe push
而不是dotnet nuget push
. 这可能会解决问题,或者至少会给您提供更有用的错误消息。
推荐阅读
- javascript - 在 Quill 中听按键 Enter
- palantir-foundry - 将 QuickBooks 与 Foundry 连接
- python - 在 Python 中检测星星
- typescript - 使用正文在 post 请求上指定 Axios 响应类型
- reactjs - 在后端连接中反应应用程序 cors 错误
- c# - 向 CsvHelper.Configuration.ClassMap 对象添加验证(字符串)
- flutter - Null 值正在保存,而不是 Flutter 中输入的值
- php - PHP/HTML 表格行在按下更新按钮时不会更改为表单
- python - 将字符串日期和时间转换为火花数据框中的时间戳
- scala - 在 Spark Databricks (scala) 中写入/读取/删除二进制数据