我有以下適用于 ubuntu-latest 的 C# (.net 6) 專案的 GitHub 操作作業流。但由于某種原因,我們需要它使用 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/[email protected],我嘗試過但失敗并出現同樣的錯誤。
任何想法如何解決這個問題?
uj5u.com熱心網友回復:
我感謝@jessehouwing 讓我意識到了這個概念。
關于這個執行緒,我的解決方案需要${{ github.workspace }},所以我的更改如下所示:
${{ github.workspace }}\Software\win-x86
${{ github.workspace }}\Software\win-x64
uj5u.com熱心網友回復:
不要依賴:
/home/runner/work/solution/project
而是使用
${{ github.workspace }}/project
這樣,它就可以為運行者指明正確的路徑,而與作業系統和配置無關
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/435865.html
