Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 48 additions & 37 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
paths-ignore:
- '**.md'

permissions:
contents: write

jobs:
build:
runs-on: ${{ matrix.os }}
Expand All @@ -22,14 +19,16 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
dotnet-version: |
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: Test
run: dotnet test --no-build --verbosity normal --configuration Release

- name: Publish SkiaSharpCompare.Cli (Linux)
if: runner.os == 'Linux'
Expand All @@ -55,67 +54,79 @@ jobs:
path: ./artifacts/cli
retention-days: 7

- name: Test
run: dotnet test --no-build --verbosity normal --configuration Release
- name: Upload NuGet package
if: runner.os == 'Linux'
uses: actions/upload-artifact@v7
with:
name: nuget-package
path: ./SkiaSharpCompare/bin/Release/*.*nupkg
if-no-files-found: error
retention-days: 7

deployRelease:
if: startsWith(github.ref, 'refs/heads/release')
runs-on: ubuntu-latest
needs: build
runs-on: ubuntu-latest
permissions:
contents: write # gh release create
id-token: write # NuGet Trusted Publishing (OIDC)
steps:
- uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
dotnet-version: |
10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Download NuGet package
uses: actions/download-artifact@v8
with:
name: nuget-package
path: ./nuget
- name: Download CLI artifacts
uses: actions/download-artifact@v8
with:
path: ./artifacts_download
pattern: cli-artifacts-*
path: ./artifacts_download
- name: NuGet login (Trusted Publishing)
uses: NuGet/login@v1
id: nugetLogin
with:
user: ${{ secrets.NUGET_USER }}
- 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
dotnet nuget push ./nuget/*.nupkg --skip-duplicate --api-key ${{ steps.nugetLogin.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
- name: Github release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: env.GITHUB_TOKEN != ''
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Attach all downloaded CLI artifacts regardless of OS
zip -r cli-artifacts.zip ./artifacts_download
gh release create ${{env.CURRENT_VERSION}} ./SkiaSharpCompare/bin/Release/*.*nupkg cli-artifacts.zip --generate-notes
# Attach all downloaded CLI artifacts regardless of OS
zip -r cli-artifacts.zip ./artifacts_download
gh release create ${{ env.CURRENT_VERSION }} ./nuget/*.*nupkg cli-artifacts.zip --repo ${{ github.repository }} --target ${{ github.sha }} --generate-notes

deployTest:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write # NuGet Trusted Publishing (OIDC)
steps:
- uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
dotnet-version: |
10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Download CLI artifacts
- name: Download NuGet package
uses: actions/download-artifact@v8
with:
path: ./artifacts_download
name: nuget-package
path: ./nuget
- name: NuGet login (Trusted Publishing)
uses: NuGet/login@v1
id: nugetLogin
with:
user: ${{ secrets.NUGET_USER }}
token-service-url: https://int.nugettest.org/api/v2/token
audience: https://int.nugettest.org
- 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
dotnet nuget push ./nuget/*.nupkg --skip-duplicate --api-key ${{ steps.nugetLogin.outputs.NUGET_API_KEY }} --source https://apiint.nugettest.org/v3/index.json
4 changes: 2 additions & 2 deletions SkiaSharpCompare/SkiaSharpCompare.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@

<ItemGroup>
<PackageReference Include="MetadataExtractor" Version="2.9.3" />
<PackageReference Include="SkiaSharp" Version="4.155.0" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="4.155.0" />
<PackageReference Include="SkiaSharp" Version="4.156.1" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="4.156.1" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.29.0.143774">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Loading