Github actions/upload-artifact@v2 与 windows-latest 中断

发布于 2025-01-09 21:55:11 字数 1908 浏览 0 评论 0原文

我有一个 C# (.net 6) 项目的以下 GitHub 操作工作流程,可以与 ubuntu-latest 配合良好。但由于某种原因,我们需要它使用 windows-latest,并且它会因错误而中断(YAML 工作流程后面跟着错误消息)。

Yaml 工作流程:

jobs:
  build:
    name: Create Release
    runs-on: windows-latest

    steps:
    - name: Setup Checkout
      uses: actions/checkout@v2
    - name: Setup .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 6.0.x
    - name: Restore .NET dependencies
      run: dotnet restore
    - name: Build .NET
      run: dotnet build --no-restore
    - name: Test .NET
      run: dotnet test --no-build --verbosity normal
    - name: Publish .NET
      run: |
        dotnet publish /p:PublishProfile=Release-win-x86 -c Release
        dotnet publish /p:PublishProfile=Release-win-x64 -c Release
    - name: Upload Published Artifact
      uses: actions/upload-artifact@v2
      with:
        name: softwarename
        path: | 
          /home/runner/work/solution/project/Software/win-x86/
          /home/runner/work/solution/project/Software/win-x64/

错误:

Upload Published Artifact
  Run actions/upload-artifact@v2
  Warning: No files were found with the provided path: 
  /home/runner/work/solution/project/Software/win-x86/
  /home/runner/work/solution/project/Software/win-x64/. No artifacts will be uploaded.
Download Published Artifact
  Run actions/download-artifact@v2
  Starting download for softwarename
  Error: Unable to find any artifacts for the associated workflow

我读了 这里我需要将 actions/upload-artifact@v2 更改为 actions/[电子邮件受保护],我尝试但失败并出现相同的错误。

知道如何解决这个问题吗?

I have the following GitHub actions workflow for a C# (.net 6) project that works fine with ubuntu-latest. But for some reason we need it to use windows-latest, and it breaks with the error (the error message followed after YAML workflow).

Yaml workflow:

jobs:
  build:
    name: Create Release
    runs-on: windows-latest

    steps:
    - name: Setup Checkout
      uses: actions/checkout@v2
    - name: Setup .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 6.0.x
    - name: Restore .NET dependencies
      run: dotnet restore
    - name: Build .NET
      run: dotnet build --no-restore
    - name: Test .NET
      run: dotnet test --no-build --verbosity normal
    - name: Publish .NET
      run: |
        dotnet publish /p:PublishProfile=Release-win-x86 -c Release
        dotnet publish /p:PublishProfile=Release-win-x64 -c Release
    - name: Upload Published Artifact
      uses: actions/upload-artifact@v2
      with:
        name: softwarename
        path: | 
          /home/runner/work/solution/project/Software/win-x86/
          /home/runner/work/solution/project/Software/win-x64/

The error:

Upload Published Artifact
  Run actions/upload-artifact@v2
  Warning: No files were found with the provided path: 
  /home/runner/work/solution/project/Software/win-x86/
  /home/runner/work/solution/project/Software/win-x64/. No artifacts will be uploaded.
Download Published Artifact
  Run actions/download-artifact@v2
  Starting download for softwarename
  Error: Unable to find any artifacts for the associated workflow

I read here that I need to change actions/upload-artifact@v2 to actions/[email protected], and I tried and failed with the same error.

Any Idea how to fix this issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冰火雁神 2025-01-16 21:55:11

我感谢@jessehouwing 让我意识到了这个概念。

关于这个线程,我的解决方案需要${{ github.workspace }},这样我的更改如下所示:

${{ github.workspace }}\Software\win-x86
${{ github.workspace }}\Software\win-x64

I give credit to @jessehouwing for making me aware of the concept.

Regarding this thread, my solution needed ${{ github.workspace }}, so that my changes looks like this:

${{ github.workspace }}\Software\win-x86
${{ github.workspace }}\Software\win-x64
静若繁花 2025-01-16 21:55:11

不要依赖:

/home/runner/work/solution/project

而是使用

${{ github.workspace }}/project

这种方式,它指向独立于操作系统和配置的运行程序的正确路径

Don't rely on:

/home/runner/work/solution/project

Instead use

${{ github.workspace }}/project

That way it points to the correct path for the runner independent of the operating system and configuration

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文