@@ -158,11 +158,29 @@ jobs:
158158 - name : Restore dependencies
159159 run : dotnet restore
160160
161+ - name : Determine Version
162+ id : version
163+ run : |
164+ # Get the latest git tag or use 1.0.0 as default
165+ LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0")
166+
167+ # Remove 'v' prefix if present
168+ VERSION=${LATEST_TAG#v}
169+
170+ # If not on a tag, add pre-release suffix with commit count and short SHA
171+ if ! git describe --exact-match --tags HEAD >/dev/null 2>&1; then
172+ COMMITS_SINCE_TAG=$(git rev-list --count ${LATEST_TAG}..HEAD 2>/dev/null || echo "0")
173+ SHORT_SHA=$(git rev-parse --short HEAD)
174+ VERSION="${VERSION}-alpha.${COMMITS_SINCE_TAG}+${SHORT_SHA}"
175+ fi
176+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
177+ echo "📦 Determined version: ${VERSION}"
178+
161179 - name : Build (Release) for packaging
162180 run : dotnet build src/NLWebNet --configuration Release --no-restore --verbosity minimal
163181
164182 - name : Pack NuGet package
165- run : dotnet pack src/NLWebNet --configuration Release --no-build --output ./packages
183+ run : dotnet pack src/NLWebNet --configuration Release --no-build --output ./packages -p:PackageVersion=${{ steps.version.outputs.version }}
166184
167185 - name : Upload package artifacts
168186 uses : actions/upload-artifact@v4
@@ -172,6 +190,9 @@ jobs:
172190 retention-days : 30
173191
174192 - name : Validate NuGet Package
175- uses : NuGetPackageExplorer/ValidatePackage@v1
176- with :
177- packagePath : ./packages/NLWebNet.1.0.0-alpha.nupkg
193+ run : |
194+ echo "📦 Validating NuGet package..."
195+ dotnet tool install --global dotnet-validate --version 0.0.1-preview.537
196+ PACKAGE_FILE=$(find ./packages -name "*.nupkg" | head -n 1)
197+ echo "Validating package: $PACKAGE_FILE"
198+ dotnet validate package local "$PACKAGE_FILE"
0 commit comments