From 97eb431b4525a209977ee19672ff29c4ff873647 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sun, 15 Feb 2026 19:24:21 +0100 Subject: [PATCH] Enhance GitVersion integration in CI pipeline with additional diagnostics and JSON output --- .gitlab-ci.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8f4df87..b2f0131 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,8 +32,20 @@ publish_nuget: git fetch --prune --unshallow || true git fetch origin +refs/heads/*:refs/remotes/origin/* || true git branch --show-current || true - - dotnet tool install --global GitVersion.Tool --version 6.5.1 || true - export PATH="$PATH:~/.dotnet/tools" + dotnet tool install --global GitVersion.Tool --version 6.5.1 || true + export PATH="$PATH:$HOME/.dotnet/tools" + # Debug: show installed dotnet tools and which gitversion is available + dotnet tool list --global || true + echo "which dotnet-gitversion: $(which dotnet-gitversion || true)" + echo "which gitversion: $(which gitversion || true)" + # Debug: print GitVersion variables to aid diagnosis + dotnet-gitversion /showvariable FullSemVer 2>/dev/null || gitversion /showvariable FullSemVer 2>/dev/null || true + dotnet-gitversion /showvariable SemVer 2>/dev/null || gitversion /showvariable SemVer 2>/dev/null || true + dotnet-gitversion /showvariable EscapedBranchName 2>/dev/null || gitversion /showvariable EscapedBranchName 2>/dev/null || true + dotnet-gitversion /showvariable PreReleaseNumber 2>/dev/null || gitversion /showvariable PreReleaseNumber 2>/dev/null || true + dotnet-gitversion /output json > gitversion.json 2>/dev/null || gitversion /output json > gitversion.json 2>/dev/null || true + echo "--- gitversion.json ---" + cat gitversion.json || true # Build a NuGet-safe version: MajorMinorPatch-EscapedBranchName.PreReleaseNumber MM=$(dotnet-gitversion /showvariable MajorMinorPatch 2>/dev/null || gitversion /showvariable MajorMinorPatch 2>/dev/null || echo "0.1.0") BR=$(dotnet-gitversion /showvariable EscapedBranchName 2>/dev/null || gitversion /showvariable EscapedBranchName 2>/dev/null || echo "master") @@ -41,7 +53,7 @@ publish_nuget: PACKAGE_VERSION="${MM}-${BR}.${PR}" PACKAGE_VERSION=$(echo "$PACKAGE_VERSION" | sed 's/[^0-9A-Za-z.-]//g') echo "Package version: $PACKAGE_VERSION" - dotnet pack src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj -c Release -o nuget /p:PackageVersion="$PACKAGE_VERSION" + dotnet pack src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj -c Release -o nuget /p:PackageVersion="$PACKAGE_VERSION" /p:Version="$PACKAGE_VERSION" dotnet nuget push "nuget/*.nupkg" --source "$NUGET_SOURCE" --api-key "$CI_JOB_TOKEN" --skip-duplicate only: - main