@@ -2,15 +2,14 @@ name: Publish to NuGet
22
33on :
44 push :
5- # branches:
6- # - main
75 tags :
86 - ' v*'
97 workflow_dispatch :
108
119env :
1210 DOTNET_SKIP_FIRST_TIME_EXPERIENCE : true
1311 DOTNET_NOLOGO : true
12+ NUGET_PACKAGES : ${{ github.workspace }}/.nuget/packages
1413
1514jobs :
1615 build-and-publish :
@@ -22,69 +21,46 @@ jobs:
2221 with :
2322 fetch-depth : 0
2423
25- - name : Fetch all tags
24+ - name : Fetch tags
2625 run : git fetch --tags
2726
28- - name : Show current tag
29- run : git describe --tags
30-
3127 - name : Setup .NET
3228 uses : actions/setup-dotnet@v4
3329 with :
3430 dotnet-version : |
3531 8.0.x
3632 9.0.x
3733 10.0.x
38- cache : true
39-
40- - name : Build Core
41- run : dotnet build src/AutoSettingUI.Core/AutoSettingUI.Core.csproj --configuration Release -p:ContinuousIntegrationBuild=true
42-
43- - name : Build Generator
44- run : dotnet build src/AutoSettingUI.Generator/AutoSettingUI.Generator.csproj --configuration Release -p:ContinuousIntegrationBuild=true
4534
46- - name : Build Extension.Shared
47- run : dotnet build src/Extensions/AutoSettingUI.Extension.Shared/AutoSettingUI.Extension.Shared.csproj --configuration Release -p:ContinuousIntegrationBuild=true
48-
49- - name : Build Avalonia
50- run : dotnet build src/Extensions/AutoSettingUI.Avalonia/AutoSettingUI.Avalonia.csproj --configuration Release -p:ContinuousIntegrationBuild=true
51-
52- - name : Build Ursa
53- run : dotnet build src/Extensions/AutoSettingUI.Ursa/AutoSettingUI.Ursa.csproj --configuration Release -p:ContinuousIntegrationBuild=true
35+ - name : Cache NuGet packages
36+ uses : actions/cache@v4
37+ with :
38+ path : ${{ github.workspace }}/.nuget/packages
39+ key : ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
40+ restore-keys : |
41+ ${{ runner.os }}-nuget-
5442
55- - name : Build WPF
56- run : dotnet build src/Extensions/AutoSettingUI.WPF /AutoSettingUI.WPF. csproj --configuration Release -p:ContinuousIntegrationBuild=true
43+ - name : Restore
44+ run : dotnet restore src/AutoSettingUI.Core/AutoSettingUI.Core.csproj src/AutoSettingUI.Generator/AutoSettingUI.Generator.csproj src/ Extensions/AutoSettingUI.Extension.Shared /AutoSettingUI.Extension.Shared. csproj src/Extensions/AutoSettingUI.Avalonia/AutoSettingUI.Avalonia.csproj src/Extensions/AutoSettingUI.Ursa/AutoSettingUI.Ursa.csproj src/Extensions/AutoSettingUI.WPF/AutoSettingUI.WPF.csproj src/AutoSettingUI.Generator.Tests/AutoSettingUI.Generator.Tests.csproj
5745
58- - name : Build Tests
59- run : dotnet build src/AutoSettingUI.Generator. Tests/AutoSettingUI.Generator.Tests.csproj --configuration Release
46+ - name : Build
47+ run : dotnet build src/AutoSettingUI.Core/AutoSettingUI.Core.csproj src/AutoSettingUI. Generator/AutoSettingUI.Generator.csproj src/Extensions/AutoSettingUI.Extension.Shared/AutoSettingUI.Extension.Shared.csproj src/Extensions/AutoSettingUI.Avalonia/AutoSettingUI.Avalonia.csproj src/Extensions/AutoSettingUI.Ursa/AutoSettingUI.Ursa.csproj src/Extensions/AutoSettingUI.WPF/AutoSettingUI.WPF.csproj src/AutoSettingUI.Generator. Tests/AutoSettingUI.Generator.Tests.csproj --configuration Release --no-restore -p:ContinuousIntegrationBuild=true
6048
61- - name : Run tests
49+ - name : Test
6250 run : dotnet test src/AutoSettingUI.Generator.Tests/AutoSettingUI.Generator.Tests.csproj --configuration Release --no-build --verbosity minimal
6351
64- - name : Pack Core
65- run : dotnet pack src/AutoSettingUI.Core/AutoSettingUI.Core.csproj --configuration Release --no-build --output artifacts
66-
67- - name : Pack Generator
68- run : dotnet pack src/AutoSettingUI.Generator/AutoSettingUI.Generator.csproj --configuration Release --no-build --output artifacts
69-
70- - name : Pack Extension.Shared
71- run : dotnet pack src/Extensions/AutoSettingUI.Extension.Shared/AutoSettingUI.Extension.Shared.csproj --configuration Release --no-build --output artifacts
72-
73- - name : Pack Avalonia
74- run : dotnet pack src/Extensions/AutoSettingUI.Avalonia/AutoSettingUI.Avalonia.csproj --configuration Release --no-build --output artifacts
75-
76- - name : Pack Ursa
77- run : dotnet pack src/Extensions/AutoSettingUI.Ursa/AutoSettingUI.Ursa.csproj --configuration Release --no-build --output artifacts
78-
79- - name : Pack WPF
80- run : dotnet pack src/Extensions/AutoSettingUI.WPF/AutoSettingUI.WPF.csproj --configuration Release --no-build --output artifacts
81-
82- - name : List packages
83- run : Get-ChildItem artifacts -Filter *.nupkg
52+ - name : Pack
53+ run : |
54+ dotnet pack src/AutoSettingUI.Core/AutoSettingUI.Core.csproj --configuration Release --no-build --output artifacts
55+ dotnet pack src/AutoSettingUI.Generator/AutoSettingUI.Generator.csproj --configuration Release --no-build --output artifacts
56+ dotnet pack src/Extensions/AutoSettingUI.Extension.Shared/AutoSettingUI.Extension.Shared.csproj --configuration Release --no-build --output artifacts
57+ dotnet pack src/Extensions/AutoSettingUI.Avalonia/AutoSettingUI.Avalonia.csproj --configuration Release --no-build --output artifacts
58+ dotnet pack src/Extensions/AutoSettingUI.Ursa/AutoSettingUI.Ursa.csproj --configuration Release --no-build --output artifacts
59+ dotnet pack src/Extensions/AutoSettingUI.WPF/AutoSettingUI.WPF.csproj --configuration Release --no-build --output artifacts
8460
8561 - name : Publish to NuGet
8662 if : startsWith(github.ref, 'refs/tags/v')
87- run : Get-ChildItem artifacts -Filter *.nupkg | ForEach-Object { dotnet nuget push $_.FullName --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate }
63+ run : dotnet nuget push artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
8864
8965 - name : Upload artifacts
9066 uses : actions/upload-artifact@v4
0 commit comments