1414env :
1515 LIB_CSPROJ : PJ.NavigationTrans.Maui/PJ.NavigationTrans.Maui.csproj
1616 SAMPLE_CSPROJ : PJ.NavigationTrans.Sample/PJ.NavigationTrans.Sample.csproj
17+ NugetPackageVersion : ' 99.0.0-preview${{ github.run_number }}'
18+ CurrentSemanticVersionBase : ' 99.0.0'
1719
1820jobs :
1921 build :
@@ -22,17 +24,50 @@ jobs:
2224
2325 steps :
2426 - uses : actions/checkout@v4
27+
2528 - name : Setup .NET
2629 uses : actions/setup-dotnet@v4
2730 with :
2831 dotnet-version : 9.0.x
32+
33+ - name : Get Nuget version and Name for PR
34+ if : ${{ github.event_name == 'pull_request' }}
35+ run : |
36+ echo "NugetPackageVersion=${{ env.CurrentSemanticVersionBase }}-build-${{ github.event.pull_request.number }}.${{ github.run_number }}+${{ github.sha }}"
37+ shell : bash
38+
2939 - name : Workload install
3040 run : dotnet workload install maui
41+
3142 - name : Restore library dependencies
3243 run : dotnet restore ${{env.LIB_CSPROJ}}
44+
3345 - name : Restore sample dependencies
3446 run : dotnet restore
47+
3548 - name : Build library
36- run : dotnet build ${{env.LIB_CSPROJ}} -c Release --no-restore
49+ run : dotnet build ${{env.LIB_CSPROJ}} -c Release -p:PackageVersion=${{ env.NugetPackageVersion }} -p:Version=${{ env.NugetPackageVersion }} --no-restore
50+
3751 - name : Build Sample app
3852 run : dotnet build ${{env.SAMPLE_CSPROJ}} -c Release --no-restore
53+
54+ - name : Create Nuget
55+ run : dotnet pack ${{env.LIB_CSPROJ}} -c Release --no-restore --no-build --include-symbols --include-source
56+
57+ - name : Copy NuGet Packages to Staging Directory
58+ if : ${{ runner.os == 'Windows' && !startsWith(github.ref, 'refs/tags/') }}
59+ run : |
60+ mkdir -p ${{ github.workspace }}/nuget
61+ Get-ChildItem -Path "./PJ.NavigationTrans.Maui/" -Recurse | Where-Object { $_.Extension -match "nupkg" } | Copy-Item -Destination "${{ github.workspace }}/nuget"
62+ shell : pwsh
63+
64+ - name : List NuGet packages found
65+ run : |
66+ Get-ChildItem -Path "${{ github.workspace }}/nuget" | Format-Table Name
67+ shell : pwsh
68+
69+ - name : Publish Packages
70+ uses : actions/upload-artifact@v4
71+ with :
72+ name : packages
73+ path : ${{ github.workspace }}/nuget/
0 commit comments