Skip to content

chore(deps): update dependency dotnet-sdk to v8.0.302 #119

chore(deps): update dependency dotnet-sdk to v8.0.302

chore(deps): update dependency dotnet-sdk to v8.0.302 #119

Workflow file for this run

name: publish
on:
push:
branches:
- 'main'
pull_request:
branches:
- '*'
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NuGetDirectory: ${{ github.workspace}}/nuget
defaults:
run:
shell: pwsh
jobs:
create_nuget:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Setup .NET Core
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4
- run: dotnet pack --configuration Release /bl
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
with:
name: nuget
if-no-files-found: error
retention-days: 3
path: '**/*.nupkg'
build_and_test:
runs-on: ${{ matrix.runs-on }}
env:
TestResultsDirectory: ${{ github.workspace}}/TestResults
strategy:
matrix:
runs-on: [ ubuntu-latest, windows-latest ]
configuration: [ Debug, Release ]
fail-fast: false
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Setup .NET Core (global.json)
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4
- run: dotnet test --configuration ${{ matrix.configuration }} --logger trx --results-directory "${{ env.TestResultsDirectory }}" /p:WarningsAsErrors=true
name: Run tests
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
if: always()
with:
name: test-results-${{ matrix.runs-on }}-${{ matrix.configuration }}
if-no-files-found: error
retention-days: 3
path: ${{ env.TestResultsDirectory }}/*.trx
deploy:
runs-on: 'ubuntu-latest'
needs: [ create_nuget, build_and_test ]
steps:
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4
with:
name: nuget
path: ${{ env.NuGetDirectory }}
- name: Setup .NET Core
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4
- run: |
Write-Host "Current ref: $env:GITHUB_REF"
Write-Host "Searching nupkg in folder: ${{ env.NuGetDirectory }}"
$files = Get-ChildItem "${{ env.NuGetDirectory }}/*" -Recurse -Include *.nupkg
foreach($file in $files) {
Write-Host "Pushing NuGet package: $($file.FullName)"
if ($env:GITHUB_REF -eq 'refs/heads/main')
{
& dotnet nuget push "$($file.FullName)" --api-key "$env:NuGetApiKey" --source https://api.nuget.org/v3/index.json --force-english-output --skip-duplicate
}
else
{
Write-Host "Not on the default branch => Do not push"
}
}
name: Publish NuGet packages
if: always()
env:
NuGetApiKey: ${{ secrets.NuGetApiKey }}