Search code examples
githubgithub-actions

Github actions/upload-artifact@v2 breaks with windows-latest


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?


Solution

  • 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