publish-nuget icon indicating copy to clipboard operation
publish-nuget copied to clipboard

[BUG] Error: 😭 error: File does not exist (1).

Open VAllens opened this issue 2 years ago • 22 comments

The push was successful, but I received an exception:

Error: 😭 error: File does not exist (1).

My publish.yml:

name: NuGet Publish

on:
  pull_request:
    branches: [ main ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 6.0.x
    - name: Restore Obfuscation.Fody project dependencies
      run: dotnet restore src/Obfuscation.Fody/Obfuscation.Fody.csproj
    - name: Restore Obfuscation.Fody.NuGet project dependencies
      run: dotnet restore src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj
    - name: Build Obfuscation.Fody project
      run: dotnet build src/Obfuscation.Fody/Obfuscation.Fody.csproj --no-restore --configuration Release
    - name: Build Obfuscation.Fody.NuGet project
      run: dotnet build src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj --no-restore --configuration Release
    - name: Pack Obfuscation.Fody.NuGet project
      run: dotnet pack src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj --no-build --configuration Release
    - name: publish nuget package on version change
      uses: rohith/publish-nuget@v2
      with:
        PROJECT_FILE_PATH: src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj
        PACKAGE_NAME: Obfuscation.Fody
        VERSION_FILE_PATH: Directory.Build.props
        NUGET_KEY: ${{secrets.NUGET_API_KEY}}

console log:

Project Filepath: src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj
Version Filepath: Directory.Build.props
Version Regex: /^\s*<Version>(.*)<\/Version>\s*$/m
Version: 1.0.0
Package Name: Obfuscation.Fody
✨ found new version (1.0.0) of Obfuscation.Fody
NuGet Source: https://api.nuget.org
executing: [dotnet build -c Release src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj]
Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  Obfuscation.Fody.NuGet -> /home/runner/work/Obfuscation.Fody/Obfuscation.Fody/src/Obfuscation.Fody.NuGet/bin/Release/Obfuscation.FodyHelper.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.94
executing: [dotnet pack  --no-build -c Release src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj -o .]
Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Successfully created package '/home/runner/work/Obfuscation.Fody/Obfuscation.Fody/Obfuscation.Fody.1.0.0.nupkg'.
  OutputPackageDir: ../../packages
  NuPkgFiles: /home/runner/work/Obfuscation.Fody/Obfuscation.Fody/src/Obfuscation.Fody.NuGet/bin/Release/Obfuscation.Fody.1.0.0.nupkg
  Copy /home/runner/work/Obfuscation.Fody/Obfuscation.Fody/src/Obfuscation.Fody.NuGet/bin/Release/Obfuscation.Fody.1.0.0.nupkg to ../../packages successfully
Generated Package(s): Obfuscation.Fody.1.0.0.nupkg
executing: [dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json -k *** --skip-duplicate -n 1]
Pushing Obfuscation.Fody.1.0.0.nupkg to 'https://www.nuget.org/api/v2/package'...
  PUT https://www.nuget.org/api/v2/package/
  Created https://www.nuget.org/api/v2/package/ 704ms
Your package was pushed.
error: File does not exist (1).


Usage: dotnet nuget push [arguments] [options]

Arguments:
  [root]  Specify the path to the package and your API key to push the package to the server.

Options:
  -h|--help                      Show help information
  --force-english-output         Forces the application to run using an invariant, English-based culture.
  -s|--source <source>           Package source (URL, UNC/folder path or package source name) to use. Defaults to DefaultPushSource if specified in NuGet.Config.
  -ss|--symbol-source <source>   Symbol server URL to use.
  -t|--timeout <timeout>         Timeout for pushing to a server in seconds. Defaults to 300 seconds (5 minutes).
  -k|--api-key <apiKey>          The API key for the server.
  -sk|--symbol-api-key <apiKey>  The API key for the symbol server.
  -d|--disable-buffering         Disable buffering when pushing to an HTTP(S) server to decrease memory usage.
  -n|--no-symbols                If a symbols package exists, it will not be pushed to a symbols server.
  --no-service-endpoint          Does not append "api/v2/package" to the source URL.
  --interactive                  Allow the command to block and require manual action for operations like authentication.
  --skip-duplicate               If a package and version already exists, skip it and continue with the next package in the push, if any.

Error: 😭 error: File does not exist (1).
/home/runner/work/_actions/rohith/publish-nuget/v2/index.js:23
        throw new Error(msg)
        ^

Error: error: File does not exist (1).
    at Action._printErrorAndExit (/home/runner/work/_actions/rohith/publish-nuget/v2/index.js:23:[15](https://github.com/VAllens/Obfuscation.Fody/runs/5226354030?check_suite_focus=true#step:9:15))
    at Action._pushPackage (/home/runner/work/_actions/rohith/publish-nuget/v2/index.js:73:18)
    at ClientRequest.<anonymous> (/home/runner/work/_actions/rohith/publish-nuget/v2/index.js:101:22)
    at Object.onceWrapper (events.js:300:26)
    at ClientRequest.emit (events.js:210:5)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:583:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:115:[17](https://github.com/VAllens/Obfuscation.Fody/runs/5226354030?check_suite_focus=true#step:9:17))
    at TLSSocket.socketOnData (_http_client.js:456:22)
    at TLSSocket.emit (events.js:[21](https://github.com/VAllens/Obfuscation.Fody/runs/5226354030?check_suite_focus=true#step:9:21)0:5)
    at addChunk (_stream_readable.js:[30](https://github.com/VAllens/Obfuscation.Fody/runs/5226354030?check_suite_focus=true#step:9:30)9:12)

here: https://github.com/VAllens/Obfuscation.Fody/runs/5226354030?check_suite_focus=true

VAllens avatar Feb 17 '22 02:02 VAllens

Got the same problem.

AddictedCS avatar Feb 18 '22 13:02 AddictedCS

Got the same issue.. Nothing has changed in my action script

Retrodad0001 avatar Feb 21 '22 17:02 Retrodad0001

Same issue

capdiem avatar Feb 22 '22 10:02 capdiem

https://github.com/NuGet/Home/issues/11601 This seems to be a problem with nuget. I don't know what version of nuget the dotnet nuget command uses. If it is up-to-date every time, this problem may be solved with the update of the version of nuget.

capdiem avatar Feb 22 '22 10:02 capdiem

Same problem here. I have fixed it by removing references to this project and just pushing manually.

I previously had this in my workflow file:

    - name: Publish NuGet
      uses: brandedoutcast/[email protected]
      with:
        PROJECT_FILE_PATH: src/GrpcBrowser/GrpcBrowser.csproj
        PACKAGE_NAME: GrpcBrowser
        VERSION_FILE_PATH: src/GrpcBrowser/GrpcBrowser.csproj
        VERSION_REGEX: \s*<Version>(.*)<\/Version>\s*
        NUGET_KEY: ${{ secrets.NUGET_KEY }}

And I have replaced it with this:

    - name: Package
      run: dotnet pack -c Release -o . GrpcBrowser/GrpcBrowser.csproj
    - name: Publish
      run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json

thomaswormald avatar Feb 23 '22 11:02 thomaswormald

Same problem here. I have fixed it by removing references to this project and just pushing manually.

I previously had this in my workflow file:

    - name: Publish NuGet
      uses: brandedoutcast/[email protected]
      with:
        PROJECT_FILE_PATH: src/GrpcBrowser/GrpcBrowser.csproj
        PACKAGE_NAME: GrpcBrowser
        VERSION_FILE_PATH: src/GrpcBrowser/GrpcBrowser.csproj
        VERSION_REGEX: \s*<Version>(.*)<\/Version>\s*
        NUGET_KEY: ${{ secrets.NUGET_KEY }}

And I have replaced it with this:

    - name: Package
      run: dotnet pack -c Release -o . GrpcBrowser/GrpcBrowser.csproj
    - name: Publish
      run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json

Missing git tag

VAllens avatar Feb 24 '22 04:02 VAllens

Same problem here. I have fixed it by removing references to this project and just pushing manually. I previously had this in my workflow file:

    - name: Publish NuGet
      uses: brandedoutcast/[email protected]
      with:
        PROJECT_FILE_PATH: src/GrpcBrowser/GrpcBrowser.csproj
        PACKAGE_NAME: GrpcBrowser
        VERSION_FILE_PATH: src/GrpcBrowser/GrpcBrowser.csproj
        VERSION_REGEX: \s*<Version>(.*)<\/Version>\s*
        NUGET_KEY: ${{ secrets.NUGET_KEY }}

And I have replaced it with this:

    - name: Package
      run: dotnet pack -c Release -o . GrpcBrowser/GrpcBrowser.csproj
    - name: Publish
      run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json

Missing git tag

Also checking if never version then check in else ignore?

Retrodad0001 avatar Feb 24 '22 07:02 Retrodad0001

Also fixed it with doing it manual like @VAllens.. I used this (for .net):

`name: Release Master NuGet

on: push: branches: [ master ]

jobs: Release: name: Release to Nuget runs-on: ubuntu-latest timeout-minutes: 10

steps:
- name: Check out Repo
  uses: actions/checkout@v2

- name: Setup dotnet
  uses: actions/setup-dotnet@v1
  with:
    dotnet-version: 6.0.x

- name: Pack
  run: dotnet pack EasyDbMigrator\\EasyDbMigrator.csproj -c Release

- name: Publish to GitHub packages 
  run: dotnet nuget push /home/runner/work/EasyDbMigrator/EasyDbMigrator/EasyDbMigrator/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate`

Retrodad0001 avatar Feb 26 '22 12:02 Retrodad0001

还修复了它,像@VAllens一样手动完成。我用了这个(对于.net):

'名称: 发布主 NuGet

on: 推: 分支: [ 主 ]

作业: 发布: 名称: 发布到 Nuget 运行:ubuntu 最新超时分钟数: 10

steps:
- name: Check out Repo
  uses: actions/checkout@v2

- name: Setup dotnet
  uses: actions/setup-dotnet@v1
  with:
    dotnet-version: 6.0.x

- name: Pack
  run: dotnet pack EasyDbMigrator\\EasyDbMigrator.csproj -c Release

- name: Publish to GitHub packages 
  run: dotnet nuget push /home/runner/work/EasyDbMigrator/EasyDbMigrator/EasyDbMigrator/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate`

Good job. Me too.

name: NuGet Publish

on:
  pull_request:
    types: [ closed ]
    branches: [ main ]

jobs:
  build:

    runs-on: ubuntu-latest
    if: github.event.pull_request.merged == true
    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 6.0.x
    - name: Restore Obfuscation.Tasks project dependencies
      run: dotnet restore src/Obfuscation.Tasks/Obfuscation.Tasks.csproj
    - name: Build Obfuscation.Tasks project
      run: dotnet build src/Obfuscation.Tasks/Obfuscation.Tasks.csproj --no-restore --configuration Release
    - name: Pack Obfuscation.Tasks project
      run: dotnet pack src/Obfuscation.Tasks/Obfuscation.Tasks.csproj --no-build --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg -o .
    - name: Publish package to NuGet
      run: dotnet nuget push *.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source "https://api.nuget.org/v3/index.json" --skip-duplicate
    - name: publish package to GitHub
      run: dotnet nuget push *.nupkg --api-key ${{secrets.PUBLISH_TO_GITHUB_TOKEN}} --source "https://nuget.pkg.github.com/VAllens/index.json" --skip-duplicate

VAllens avatar Feb 28 '22 00:02 VAllens

Same issue here, however, the packaged was published successfully

Kurpanik avatar Feb 28 '22 10:02 Kurpanik

Same error message with the package being published successfully.

I recently changed from .net 5 to 6:

   steps:
    - name: Setup .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 5.0.x

to

   steps:
    - name: Setup .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 6.0.x

Maybe that triggered the error message.

Peter-B- avatar Mar 07 '22 09:03 Peter-B-

For those having the same problem, It seems to be a dotnet 6 topic. The problem is with the option -n (no symbols). In previous versions of dotnet , using this parameter requires a value (true or false, 1 or 0). Since dotnet 6.0.102 -> 6.0.200 the value is not required anymore.

This is even written in the doc or on the help output for dotnet nuget push --help -n|--no-symbols If a symbols package exists, it will not be pushed to a symbols server.

More info here

YounesCheikh avatar Mar 09 '22 22:03 YounesCheikh

You can use version 3.0.3 of this fork https://github.com/alirezanet/publish-nuget which among others includes a fix for this issue

Kurounin avatar Mar 11 '22 12:03 Kurounin

You can use version 3.0.1 of this fork https://github.com/alirezanet/publish-nuget which among others includes a fix for this issue

There are a mountain of forks for this action. It would be really great if we identified and settled on one as the new "source of truth" for publishing to NuGet from GitHub Actions, since this repository seems to be abandoned.

wbaldoumas avatar Mar 19 '22 21:03 wbaldoumas

You can use version 3.0.1 of this fork https://github.com/alirezanet/publish-nuget which among others includes a fix for this issue

There are a mountain of forks for this action. It would be really great if we identified and settled on one as the new "source of truth" for publishing to NuGet from GitHub Actions, since this repository seems to be abandoned.

I still don't see why use a Github action to push to nuget while you can achieve that by writing some lines? I abandoned the usage of this action and I'm using a native dotnet commands to push to nuget

YounesCheikh avatar Mar 20 '22 23:03 YounesCheikh

您可以使用此分叉 https://github.com/alirezanet/publish-nuget 版本3.0.1,其中包括针对此问题的修复程序

这个动作有一堆叉子。如果我们确定并确定一个作为从 GitHub Actions 发布到 NuGet 的新"事实源",那将非常棒,因为此存储库似乎已被放弃。

我仍然不明白为什么使用Github操作来推送到nuget,而您可以通过编写一些行来实现这一点?我放弃了使用此操作,并且我正在使用本机dotnet命令推送到nuget

I'm now also using dotnet command to push to nuget. The plugin, which has the advantage of Automatically git tag

VAllens avatar Mar 21 '22 01:03 VAllens

You can use version 3.0.1 of this fork https://github.com/alirezanet/publish-nuget which among others includes a fix for this issue

There are a mountain of forks for this action. It would be really great if we identified and settled on one as the new "source of truth" for publishing to NuGet from GitHub Actions, since this repository seems to be abandoned.

I still don't see why use a Github action to push to nuget while you can achieve that by writing some lines? I abandoned the usage of this action and I'm using a native dotnet commands to push to nuget

The advantage is that it checks whether the version in .csproj was modified and only runs build, pack, publish and then git tag if necessary.

Kurounin avatar Mar 21 '22 05:03 Kurounin

This is still an issue.

ThomasWillumsen avatar May 05 '22 08:05 ThomasWillumsen

This is still an issue.

There is a good fork of it. Simply replace this part in your workflow with alirezanet/[email protected] and your are done

Kurpanik avatar May 05 '22 09:05 Kurpanik

Yeah I'll either do that or just drop it and use dotnet nuget push. Thanks.

ThomasWillumsen avatar May 05 '22 09:05 ThomasWillumsen

If other functions of this workflow like tagging are not needed, using dotnet nuget push directly is of course a viable and probably a better option :)

Kurpanik avatar May 05 '22 10:05 Kurpanik

Problem solved for me. Your dotnet-version of the job is must be same to dotnet version of your project. dotnet version of my project is 5.0 but dotnet version in my job is 6.0.x. I changed version 6.0.x to 5.0.x in the job.

KursatSonmez avatar Aug 25 '22 17:08 KursatSonmez