I am trying to build my dotnet class library project via GitHub Actions. My project uses a private NuGet package stored on the GPR in addition to some standard nuget.org packages. I have not been able to get a successful build like I have on my local machine.
I am using setup-dotnet
(and have tried warrenbuckley/Setup-Nuget
, but no luck):
jobs:
build:
runs-on: windows-latest # I started with ubuntu-latest, but the dotnet nuget is missing functionality.
steps:
- uses: actions/checkout@master
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.100'
source-url: https://nuget.pkg.github.com/owner/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- run: dotnet restore --source # fails here
- run: dotnet build -c Release --no-restore
I know it finds the proper GPR because here it successfully installs my private packages, but fails to find any of the nuget.org pacakges.
Another variation I've tried:
- run: dotnet nuget add source https://nuget.pkg.github.com/myorg/index.json -n "My Source"
- run: dotnet build -c Release --no-restore # fails here
Here, it cannot find my private pacakges.
Recently, I've tried the nuget cli:
- uses: warrenbuckley/Setup-Nuget@v1
- run: nuget sources Add -Source https://nuget.pkg.github.com/myorg/index.json -Name "My Org" -username myorguser -password ${{secrets.GITHUB_TOKEN}} -StorePasswordInClearText
- run: nuget restore # Fails here
- run: dotnet build -c Release --no-restore
This gives the most information, but still fails to find my GPR packages, even though (unlike the previous examples) it finds all the sources I would expect (local, nuget.org, and my private org). Here are some of the logs that seem interesting:
32 NotFound https://nuget.pkg.github.com/myorg/download/mypackage/index.json
...
65 NotFound https://api.nuget.org/v3-flatcontainer/efinitycore/index.json
...
930 NU1101: Unable to find package MyPackage. No packages exist with this id in source(s): My Org, Microsoft Visual Studio Offline Packages, nuget.org
931 Errors in D:\a\WorkflowLibrary\WorkflowLibrary\WorkflowLibrary.Tests\WorkflowLibrary.Tests.csproj
932 NU1101: Unable to find package MyPackage. No packages exist with this id in source(s): My Org, Microsoft Visual Studio Offline Packages, nuget.org
...
935 NuGet Config files used:
C:\Users\runneradmin\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
C:\Program Files (x86)\NuGet\Config\Xamarin.Offline.config
942 Feeds used:
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
https://api.nuget.org/v3/index.json
https://nuget.pkg.github.com/myorg/index.json