我无法获得gitHub操作来将我的软件包构建发布到nuget.pkg.github

时间:2020-08-07 21:27:47

标签: github github-actions

我已经尝试了几个月,只是为了让GitHub采取行动将构建推送到gitHub软件包,每次我回来时,尝试其他尝试,似乎都没有任何效果,并且没有任何意义。

我刚刚在这里看到了一个新链接,其中为gitActions添加了更多详细信息:

enter image description here

我很兴奋,被点击,看到的代码比以前更多:

// 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"

因此,我转到yml页面(均在GitHub内),发现格式略有不同...他们缺少“-名称:xxx”和“运行:xxx”

所以,我更新了...这是我的完整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" 

现在,我想也许它会抱怨密码或其他东西,但是,我只是得到了这个错误:(即“错误:无法识别的命令或参数'add'”)

enter image description here

我完全不知所措,不知道该怎么做以及如何做...。它在gitHub中都可以正常构建,我的包位置在GitHub中,我在做什么错了?

编辑: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

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

运行此行时

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

1 个答案:

答案 0 :(得分:1)

根据enter image description here的MSDN文档,仅从SDK 3.1.200起可用;请参见。而您当前正在使用3.1.101。

更新您的YAML文件以安装等于或大于3.1.200的SDK版本