【发布时间】:2025-12-23 13:10:11
【问题描述】:
在这个问题上卡了很久,似乎是一个接一个的问题,只是试图让 GitHub Actions 将一个 nuGet 包发布到 GitHub 包,文档真的很难找到而且似乎没有给出任何明确例子
这是我之前的问题(仅用于上下文以防万一) I cant get gitHub actions to publish my package build to 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 push "bin/Release/EurekaShared.1.0.0.nupkg" --source "github" -k "${{ secrets.GITHUB_TOKEN }}"吗? (见docs.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-push) -
似乎
.nupkg文件不在您期望的位置。您能否将构建和打包步骤的输出日志添加到您的问题中。
标签: github github-actions