I cant get gitHub actions to publish my package build to nuget.pkg.github

回眸只為那壹抹淺笑 提交于 2021-01-29 15:30:35

问题


I have been trying for a few months now, just to get GitHub actions to push a build to the gitHub packages, everytime i come back, try something else, nothing seems to work and it isnt making any sense.

I have just seen a new link with more details added for gitActions here:

I got excited, clicked, and see more code than previous had:

// Step 1: Authenticate (if this is the first time) Note you must also pass --store-password-in-clear-text on non-Windows systems.
$ dotnet nuget add source https://nuget.pkg.github.com/xxxxx/index.json -n github -u xxxxx -p GH_TOKEN [--store-password-in-clear-text]
// Step 2: Pack
$ dotnet pack --configuration Release
// Step 3: Publish
$ dotnet nuget push "bin/Release/myproject.1.0.0.nupkg" --source "github"

so, i went to my yml page (all within GitHub) and noticed the format is a little different... they are missing the "- name: xxx" and "run: xxx"

so, i updated... here is my full 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.101
    - 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/xxxx/index.json -n github -u xxxx-p GH_TOKEN [--store-password-in-clear-text]
    - name: nuGet pack
      run: dotnet pack --configuration Release
    - name: publish
      run: dotnet nuget push "bin/Release/projectname.1.0.0.nupkg" --source "github" 

now, i thought maybe it would complain about password or something, but instead, im just getting this error: (i.e. "error: Unrecognized command or argument 'add'")

I am at a total loss and have no idea what and how to do this.... it builds fine all in gitHub, my package location is in GitHub, what am i doing so wrong?

EDIT: thank you @ColinM after adjusting the yml above and just changin the version to 3.1.200, it now gets further, however, getting the following

Password encryption is not supported on .NET Core for this platform. The following feed try to use an encrypted password: 'github'. You can use a clear text password as a workaround

when running this line

Run dotnet nuget add source nuget.pkg.github.com/myname/index.json -n github -u myname -p abc123"

回答1:


As per the MSDN documentation for dotnet nuget source add, this is available only from SDK 3.1.200 onwards; whereas you're currently using 3.1.101.

Update your YAML file to install an SDK version equal to or greater than 3.1.200



来源:https://stackoverflow.com/questions/63309348/i-cant-get-github-actions-to-publish-my-package-build-to-nuget-pkg-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!