66
77jobs :
88 build :
9- runs-on : windows-latest
10-
11- env :
12- dotnet-version : ' 9.0.x'
13-
14- steps :
15- - name : Checkout
16- uses : actions/checkout@v2
17- with :
18- fetch-depth : 0
19-
20- - name : Setup .NET Core SDK ${{ env.dotnet-version }}
21- uses : actions/setup-dotnet@v4
22- with :
23- dotnet-version : ${{ env.dotnet-version }}
24-
25- - name : Test
26- run : dotnet test -c Release
27-
28- - name : Get version from built assembly and set snapshot version
29- id : set-version
30- shell : powershell
31- run : |
32- # Get the assembly version from the built DLL. It's already built from the test step.
33- $assemblyPath = "Numerics/bin/Release/net8.0/Numerics.dll"
34-
35- # Load the assembly and get its version
36- $assembly = [System.Reflection.Assembly]::LoadFrom((Resolve-Path $assemblyPath).Path)
37- $assemblyVersion = $assembly.GetName().Version
38-
39- # Extract major.minor.patch from assembly version
40- $baseVersion = "$($assemblyVersion.Major).$($assemblyVersion.Minor).$($assemblyVersion.Build)"
41-
42- # Create snapshot version with GitHub run number
43- $snapshotVersion = "${baseVersion}.${{ github.run_number }}-dev"
44-
45- # Output the version for use in next steps
46- echo "SNAPSHOT_VERSION=$snapshotVersion" | Out-File -FilePath $env:GITHUB_ENV -Append
47- echo "BASE_VERSION=$baseVersion" | Out-File -FilePath $env:GITHUB_ENV -Append
48-
49- # Also set as step output
50- echo "version=$snapshotVersion" >> $env:GITHUB_OUTPUT
51- echo "base_version=$baseVersion" >> $env:GITHUB_OUTPUT
52-
53- # Display the version
54- Write-Host "Assembly Version: $assemblyVersion"
55- Write-Host "Base Version: $baseVersion"
56- Write-Host "Snapshot Version: $snapshotVersion"
57-
58- - name : Pack
59- run : |
60- # Use the snapshot version from the previous step
61- dotnet pack --configuration Release /p:PackageVersion=$env:SNAPSHOT_VERSION
62- Write-Host "Created package with version: $env:SNAPSHOT_VERSION"
63- shell : powershell
64-
65- - name : Publish
66- run : dotnet nuget push "**/*.nupkg" --api-key ${{ secrets.NEXUS_NUGET_APIKEY }} --source "https://www.hec.usace.army.mil/nexus/repository/consequences-nuget-public/" --skip-duplicate
9+ uses : HydrologicEngineeringCenter/dotnet-workflows/.github/workflows/snapshot.yml@main
10+ with :
11+ dotnet-version : ' 9.0.x'
12+ project-names : ' Numerics'
13+ run-tests : true
14+ nuget-source : ' https://www.hec.usace.army.mil/nexus/repository/consequences-nuget-public/'
15+ secrets :
16+ NUGET_API_KEY : ${{ secrets.NEXUS_NUGET_APIKEY }}
0 commit comments