Skip to content

Conversation

Copy link

Copilot AI commented Dec 6, 2025

Updates the GitHub Actions workflow to use actions/checkout@v5 instead of v6 for consistency with other action versions.

Changes

Action version update

  • Updated actions/checkout from v6 to v5 across all jobs (build, deployRelease, deployTest)

The workflow continues to build and test the solution across multiple platforms (Ubuntu, macOS, Windows) and release NuGet packages as before. No functional changes to the build, test, or deployment processes.

Note

The initial commits in this PR attempted to add CLI artifact publishing for a non-existent SkiaSharpCompare.Cli project, which caused build failures. Those changes have been reverted, leaving only the actions/checkout version update.

Original prompt

Problem: The GitHub Actions workflow fails during the release step because gh release create attempts to upload directories (e.g. ./artifacts_download/cli-artifacts-windows-latest/win-arm64) which causes: "Post "https://uploads.github.com/repos/.../assets?label=\u0026name=win-arm64\": read ./artifacts_download/.../win-arm64: is a directory". Solution: compress each downloaded artifact directory into a .zip file on the release runner and update the gh release create commands to upload .zip files instead of directories.

Change required: Update .github/workflows/dotnet.yml to add a step that zips any directories found under ./artifacts_download, and update the gh release create commands in both deployRelease and deployTest jobs to include the zip files (./artifacts_download/**/*.zip) instead of the directory glob that caused the error. Also keep existing uploaded nupkg files.

Here is the updated .github/workflows/dotnet.yml content to apply (replace the existing file):

name: .NET build and test
env:
  CURRENT_VERSION: 3.2.${{ github.run_number }}
  LAST_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}

on:
  push:

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    steps:
    - uses: actions/checkout@v5
    - name: Setup .NET
      uses: actions/setup-dotnet@v5
      with:
        dotnet-version: | 
          8.0.x
          9.0.x
          10.0.x
    - name: Check formatting
      run: dotnet format --verify-no-changes
    - name: Restore dependencies
      run: dotnet restore
    - name: Build
      run: dotnet build --configuration Release --no-restore

    - name: Publish SkiaSharpCompare.Cli (Linux)
      if: runner.os == 'Linux'
      run: |
        dotnet publish SkiaSharpCompare.Cli/SkiaSharpCompare.Cli.csproj -c Release -r linux-x64 --self-contained true -p:PublishSingleFile=true -o ./artifacts/cli/linux-x64

    - name: Publish SkiaSharpCompare.Cli (macOS)
      if: runner.os == 'macOS'
      run: |
        dotnet publish SkiaSharpCompare.Cli/SkiaSharpCompare.Cli.csproj -c Release -r osx-x64 --self-contained true -p:PublishSingleFile=true -o ./artifacts/cli/osx-x64

    - name: Publish SkiaSharpCompare.Cli (Windows)
      if: runner.os == 'Windows'
      shell: powershell
      run: |
        dotnet publish SkiaSharpCompare.Cli/SkiaSharpCompare.Cli.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -o ./artifacts/cli/win-x64
        dotnet publish SkiaSharpCompare.Cli/SkiaSharpCompare.Cli.csproj -c Release -r win-arm64 --self-contained true -p:PublishSingleFile=true -o ./artifacts/cli/win-arm64

    - name: Upload CLI artifacts
      uses: actions/upload-artifact@v4
      with:
        name: cli-artifacts-${{ matrix.os }}
        path: ./artifacts/cli

    - name: Test
      run: dotnet test --no-build --verbosity normal --configuration Release

  deployRelease:
    if: startsWith(github.ref, 'refs/heads/release')
    runs-on: ubuntu-latest
    needs: build
    steps:
    - uses: actions/checkout@v5
    - name: Setup .NET
      uses: actions/setup-dotnet@v5
      with:
        dotnet-version: | 
          8.0.x
          9.0.x
          10.0.x
    - name: Restore dependencies
      run: dotnet restore
    - name: Build
      run: dotnet build --configuration Release --no-restore
    - name: Download CLI artifacts
      uses: actions/download-artifact@v4
      with:
         path: ./artifacts_download
    - name: Compress downloaded CLI artifacts
      run: |
        # Zip any directories under artifacts_download so gh release receives files, not directories
        find ./artifacts_download -type d -mindepth 1 -print0 | while IFS= read -r -d '' dir; do
          if [ -e "${dir}.zip" ]; then
            echo "Skipping existing ${dir}.zip"
          else
            echo "Zipping $dir -> ${dir}.zip"
            zip -r "${dir}.zip" "$dir"
          fi
        done
    - name: NugetPush
      env: 
          NUGET_TOKEN_EXISTS: ${{ secrets.NUGET_TOKEN }}
      if: env.NUGET_TOKEN_EXISTS != ''
      run: |
        dotnet nuget push ./SkiaSharpCompare/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
    - name: Github release
      env:
          GITHUB_TOKEN: ${{ github.TOKEN }}
      if: env.GITHUB_TOKEN != ''
      run: |
          # Attach all downloaded CLI artifacts (zipped) and nupkg files
          gh release create ${{env.CURRENT_VERSION}} ./SkiaSharpCompare/bin/Release/*.*nupkg ./artifacts_download/**/*.zip --generate-notes

  deployTest:
    if: ${{ !startsWith(github.ref, 'refs/heads/release') }}
    runs-on: ubuntu-latest
    needs: build
    steps:
    - uses: actions/checkout@v5
    - name: Setup .NET
      uses: actions/setup-dotnet@v5
      with:
        dotnet-version: | 
          8.0.x
          9.0.x
          10.0.x
    - name: Restore dependencies
      run: dotnet restore
    - name: Bu...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created as a result of the following prompt from Copilot chat.*
> Problem: The GitHub Actions workflow fails during the release step because gh release create attempts to upload directories (e.g. ./artifacts_download/cli-artifacts-windows-latest/win-arm64) which causes: "Post \"https://uploads.github.com/repos/.../assets?label=\u0026name=win-arm64\": read ./artifacts_download/.../win-arm64: is a directory". Solution: compress each downloaded artifact directory into a .zip file on the release runner and update the gh release create commands to upload .zip files instead of directories.
> 
> Change required: Update .github/workflows/dotnet.yml to add a step that zips any directories found under ./artifacts_download, and update the gh release create commands in both deployRelease and deployTest jobs to include the zip files (./artifacts_download/**/*.zip) instead of the directory glob that caused the error. Also keep existing uploaded nupkg files.
> 
> Here is the updated .github/workflows/dotnet.yml content to apply (replace the existing file):
> 
> ```yaml
> name: .NET build and test
> env:
>   CURRENT_VERSION: 3.2.${{ github.run_number }}
>   LAST_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
> 
> on:
>   push:
> 
> jobs:
>   build:
>     runs-on: ${{ matrix.os }}
>     strategy:
>       matrix:
>         os: [ubuntu-latest, macos-latest, windows-latest]
>     steps:
>     - uses: actions/checkout@v5
>     - name: Setup .NET
>       uses: actions/setup-dotnet@v5
>       with:
>         dotnet-version: | 
>           8.0.x
>           9.0.x
>           10.0.x
>     - name: Check formatting
>       run: dotnet format --verify-no-changes
>     - name: Restore dependencies
>       run: dotnet restore
>     - name: Build
>       run: dotnet build --configuration Release --no-restore
> 
>     - name: Publish SkiaSharpCompare.Cli (Linux)
>       if: runner.os == 'Linux'
>       run: |
>         dotnet publish SkiaSharpCompare.Cli/SkiaSharpCompare.Cli.csproj -c Release -r linux-x64 --self-contained true -p:PublishSingleFile=true -o ./artifacts/cli/linux-x64
> 
>     - name: Publish SkiaSharpCompare.Cli (macOS)
>       if: runner.os == 'macOS'
>       run: |
>         dotnet publish SkiaSharpCompare.Cli/SkiaSharpCompare.Cli.csproj -c Release -r osx-x64 --self-contained true -p:PublishSingleFile=true -o ./artifacts/cli/osx-x64
> 
>     - name: Publish SkiaSharpCompare.Cli (Windows)
>       if: runner.os == 'Windows'
>       shell: powershell
>       run: |
>         dotnet publish SkiaSharpCompare.Cli/SkiaSharpCompare.Cli.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -o ./artifacts/cli/win-x64
>         dotnet publish SkiaSharpCompare.Cli/SkiaSharpCompare.Cli.csproj -c Release -r win-arm64 --self-contained true -p:PublishSingleFile=true -o ./artifacts/cli/win-arm64
> 
>     - name: Upload CLI artifacts
>       uses: actions/upload-artifact@v4
>       with:
>         name: cli-artifacts-${{ matrix.os }}
>         path: ./artifacts/cli
> 
>     - name: Test
>       run: dotnet test --no-build --verbosity normal --configuration Release
> 
>   deployRelease:
>     if: startsWith(github.ref, 'refs/heads/release')
>     runs-on: ubuntu-latest
>     needs: build
>     steps:
>     - uses: actions/checkout@v5
>     - name: Setup .NET
>       uses: actions/setup-dotnet@v5
>       with:
>         dotnet-version: | 
>           8.0.x
>           9.0.x
>           10.0.x
>     - name: Restore dependencies
>       run: dotnet restore
>     - name: Build
>       run: dotnet build --configuration Release --no-restore
>     - name: Download CLI artifacts
>       uses: actions/download-artifact@v4
>       with:
>          path: ./artifacts_download
>     - name: Compress downloaded CLI artifacts
>       run: |
>         # Zip any directories under artifacts_download so gh release receives files, not directories
>         find ./artifacts_download -type d -mindepth 1 -print0 | while IFS= read -r -d '' dir; do
>           if [ -e "${dir}.zip" ]; then
>             echo "Skipping existing ${dir}.zip"
>           else
>             echo "Zipping $dir -> ${dir}.zip"
>             zip -r "${dir}.zip" "$dir"
>           fi
>         done
>     - name: NugetPush
>       env: 
>           NUGET_TOKEN_EXISTS: ${{ secrets.NUGET_TOKEN }}
>       if: env.NUGET_TOKEN_EXISTS != ''
>       run: |
>         dotnet nuget push ./SkiaSharpCompare/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
>     - name: Github release
>       env:
>           GITHUB_TOKEN: ${{ github.TOKEN }}
>       if: env.GITHUB_TOKEN != ''
>       run: |
>           # Attach all downloaded CLI artifacts (zipped) and nupkg files
>           gh release create ${{env.CURRENT_VERSION}} ./SkiaSharpCompare/bin/Release/*.*nupkg ./artifacts_download/**/*.zip --generate-notes
> 
>   deployTest:
>     if: ${{ !startsWith(github.ref, 'refs/heads/release') }}
>     runs-on: ubuntu-latest
>     needs: build
>     steps:
>     - uses: actions/checkout@v5
>     - name: Setup .NET
>       uses: actions/setup-dotnet@v5
>       with:
>         dotnet-version: | 
>           8.0.x
>           9.0.x
>           10.0.x
>     - name: Restore dependencies
>       run: dotnet restore
>     - name: Build
>       run: dotnet build --configuration Release --no-restore
>     - name: Download CLI artifacts
>       uses: actions/download-artifact@v4
>       with:
>          path: ./artifacts_download
>     - name: Compress downloaded CLI artifacts
>       run: |
>         # Zip any directories under artifacts_download so gh release receives files, not directories
>         find ./artifacts_download -type d -mindepth 1 -print0 | while IFS= read -r -d '' dir; do
>           if [ -e "${dir}.zip" ]; then
>             echo "Skipping existing ${dir}.zip"
>           else
>             echo "Zipping $dir -> ${dir}.zip"
>             zip -r "${dir}.zip" "$dir"
>           fi
>         done
>     - name: NugetPush
>       env:
>           NUGET_TOKEN_EXISTS: ${{ secrets.NUGET_TEST_TOKEN }}
>       if: env.NUGET_TOKEN_EXISTS != ''
>       run: |
>           ls ./SkiaSharpCompare/bin/Release
>           dotnet nuget push ./SkiaSharpCompare/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TEST_TOKEN}} --source https://apiint.nugettest.org/v3/index.json
>     - name: Github prerelease
>       shell: bash
>       env:
>         GITHUB_TOKEN: ${{ github.TOKEN }}
>       if: env.GITHUB_TOKEN != ''
>       run: |
>         gh release create ${{env.CURRENT_VERSION}} ./SkiaSharpCompare/bin/Release/*.*nupkg ./artifacts_download/**/*.zip --prerelease --generate-notes
> ```
> 
> Notes:
> - This approach ensures gh release receives files (zip archives) instead of directories and prevents the "is a directory" error.
> - The find+zip command runs on the ubuntu runners used for deployRelease and deployTest. If you later change the runner to Windows, you'll need a cross-platform approach (e.g., create zips in the build job and upload them as artifacts instead).
> 
> Please create a PR that: 
> - Creates a branch (e.g., fix/zip-release-artifacts)
> - Replaces .github/workflows/dotnet.yml with the updated content above
> - Opens the PR against the default branch
> 
> 

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

Co-authored-by: stesee <168659+stesee@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Dec 6, 2025


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

1 similar comment
@github-actions
Copy link

github-actions bot commented Dec 6, 2025


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@stesee
Copy link

stesee commented Dec 6, 2025

@copilot address the issues in the build config

Co-authored-by: stesee <168659+stesee@users.noreply.github.com>
Copilot AI changed the title [WIP] Update GitHub Actions to zip artifact directories before release Fix release upload failure by zipping artifact directories and patch download-artifact CVE Dec 6, 2025
Copilot AI requested a review from stesee December 6, 2025 13:03
@stesee
Copy link

stesee commented Dec 6, 2025

@copilot address this error:

Run dotnet publish SkiaSharpCompare.Cli/SkiaSharpCompare.Cli.csproj -c Release -r osx-x64 --self-contained true -p:PublishSingleFile=true -o ./artifacts/cli/osx-x64
MSBUILD : error MSB1009: Project file does not exist.
Switch: SkiaSharpCompare.Cli/SkiaSharpCompare.Cli.csproj
Error: Process completed with exit code 1.

Co-authored-by: stesee <168659+stesee@users.noreply.github.com>
Copy link
Author

Copilot AI commented Dec 6, 2025

@copilot address the issues in the build config

Fixed in b276b66. The workflow was attempting to publish a non-existent SkiaSharpCompare.Cli project. Removed all CLI-related steps - the workflow now only builds, tests, and releases the actual projects in the solution.

Copilot AI changed the title Fix release upload failure by zipping artifact directories and patch download-artifact CVE Update workflow to use actions/checkout@v5 Dec 6, 2025
Copy link
Author

Copilot AI commented Dec 6, 2025

@copilot address this error:

Run dotnet publish SkiaSharpCompare.Cli/SkiaSharpCompare.Cli.csproj -c Release -r osx-x64 --self-contained true -p:PublishSingleFile=true -o ./artifacts/cli/osx-x64
...

This error was from run #239 (commit 76dee20), before the fix. The issue has already been resolved in b276b66 which removed all CLI project references. The current workflow no longer attempts to publish the non-existent SkiaSharpCompare.Cli project. Run #240 is waiting for approval to verify the fix.

@stesee stesee closed this Dec 6, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2025
@stesee stesee deleted the copilot/update-release-zip-uploads branch December 6, 2025 14:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants