File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,22 +12,29 @@ jobs:
1212 build :
1313 runs-on : ubuntu-latest
1414 steps :
15+
1516 - name : Checkout
1617 uses : actions/checkout@v2
1718 with :
1819 fetch-depth : 0
20+
1921 - name : Setup dotnet 8.0
2022 uses : actions/setup-dotnet@v4
2123 with :
2224 dotnet-version : ' 8.0.100'
25+
2326 - name : Clean
2427 run : dotnet clean -c Release
28+
2529 - name : Build
2630 run : dotnet build -c Release
31+
2732 - name : Test
2833 run : dotnet test -c Release --no-build -l trx --verbosity=normal ./test/ConfigurationRepository.UnitTests/ConfigurationRepository.UnitTests.csproj
34+
2935 - name : Pack
3036 run : dotnet pack -c Release -o artifacts --no-build
37+
3138 - name : Artifacts
3239 uses : actions/upload-artifact@v4
3340 with :
Original file line number Diff line number Diff line change @@ -12,23 +12,36 @@ jobs:
1212 fail-fast : false
1313 runs-on : ubuntu-latest
1414 steps :
15+
1516 - name : Checkout
1617 uses : actions/checkout@v2
1718 with :
1819 fetch-depth : 0
20+
1921 - name : Setup dotnet 8.0
2022 uses : actions/setup-dotnet@v4
2123 with :
2224 dotnet-version : ' 8.0.100'
23- - name : Build and Test
24- run : ./Build.ps1
25- shell : pwsh
25+
26+ - name : Clean
27+ run : dotnet clean -c Release
28+
29+ - name : Build
30+ run : dotnet build -c Release
31+
32+ - name : Test
33+ run : dotnet test -c Release --no-build -l trx --verbosity=normal ./test/ConfigurationRepository.UnitTests/ConfigurationRepository.UnitTests.csproj
34+
35+ - name : Pack
36+ run : dotnet pack -c Release -o artifacts --no-build
37+
2638 - name : Push to NuGet
2739 env :
2840 NUGET_URL : https://api.nuget.org/v3/index.json
2941 NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
3042 run : ./Push.ps1
3143 shell : pwsh
44+
3245 - name : Artifacts
3346 uses : actions/upload-artifact@v4
3447 with :
Original file line number Diff line number Diff line change 1+ $scriptName = $MyInvocation.MyCommand.Name
2+ $artifacts = " ./artifacts"
3+
4+ if ([string ]::IsNullOrEmpty($Env: NUGET_API_KEY )) {
5+ Write-Host " ${scriptName} : NUGET_API_KEY is empty or not set. Skipped pushing package(s)."
6+ } else {
7+ Get-ChildItem $artifacts - Filter " *.nupkg" | ForEach-Object {
8+ Write-Host " $ ( $scriptName ) : Pushing $ ( $_.Name ) "
9+ dotnet nuget push $_ -- source $Env: NUGET_URL -- api- key $Env: NUGET_API_KEY
10+ if ($lastexitcode -ne 0 ) {
11+ throw (" Exec: " + $errorMessage )
12+ }
13+ }
14+ }
You can’t perform that action at this time.
0 commit comments