2828 pack :
2929 runs-on : ubuntu-latest
3030 steps :
31- - name : 📥 Checkout code
31+ - name : 📥 Checkout
3232 uses : actions/checkout@v4
3333 with :
3434 ref : ${{ inputs.checkout_ref }}
@@ -39,31 +39,38 @@ jobs:
3939 with :
4040 dotnet-version : " 9.0.x"
4141
42- - name : 🔄 Restore dependencies
42+ - name : 🔄 Restore
4343 run : dotnet restore
4444
4545 - name : 🏗️ Build
46- run : dotnet build --configuration ${{ inputs.build_configuration }} --no-restore
46+ run : dotnet build -c ${{ inputs.build_configuration }} --no-restore
4747
4848 - name : 📦 Pack
49- id : pack
5049 run : |
51- # include symbols/source on dev prerelease if requested
50+ # symbols/source only when caller asks
5251 EXTRA_FLAGS=""
5352 if [ "${{ inputs.force_dev_prerelease }}" = "true" ]; then
5453 EXTRA_FLAGS="--include-symbols --include-source"
5554 fi
5655
57- # Pass PublicRelease=true for a public release (omit commit ID)
58- dotnet pack --configuration ${{ inputs.build_configuration }} \
56+ # PublicRelease strips commit-height *only* on Release builds
57+ PUBLIC_RELEASE_FLAG=""
58+ if [ "${{ inputs.build_configuration }}" = "Release" ]; then
59+ PUBLIC_RELEASE_FLAG="-p:PublicRelease=true"
60+ fi
61+
62+ dotnet pack -c ${{ inputs.build_configuration }} \
5963 --no-build --no-restore \
6064 --output ./artifacts \
61- -p:PublicRelease=true \
65+ $PUBLIC_RELEASE_FLAG \
6266 $EXTRA_FLAGS
6367
6468 - name : 🚀 Publish to NuGet
6569 if : ${{ inputs.push_after_pack }}
70+ env :
71+ NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
6672 run : |
67- dotnet nuget push ./artifacts/*.nupkg \
68- --api-key ${{ secrets.NUGET_API_KEY }} \
69- --source https://api.nuget.org/v3/index.json
73+ dotnet nuget push "./artifacts/*.nupkg" \
74+ --api-key "$NUGET_API_KEY" \
75+ --source https://api.nuget.org/v3/index.json \
76+ --skip-duplicate
0 commit comments