From 25f41c1513efd650cea66789206a471e11f7cb7e Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sun, 15 Feb 2026 18:42:35 +0100 Subject: [PATCH] Update CI to .NET 10, improve versioning and packaging - Switch CI pipeline to use .NET 10.0 SDK images for build and publish jobs - Set GIT_DEPTH=0 and fetch full git history for accurate versioning - Refactor publish_nuget job to sanitize and inject GitVersion output into package version - Downgrade GitVersion.MsBuild to 5.13.0 to match CLI tool version - In csproj, set from sanitized GitVersion output with fallback - Remove prevent-increment-of-merged-branch-version from GitVersion.yml for main/master --- .gitlab-ci.yml | 26 ++++++++++++-------- GitVersion.yml | 2 -- src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj | 10 +++++--- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9b9323c..d02c350 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,8 +5,9 @@ stages: variables: DOTNET_CLI_TELEMETRY_OPTOUT: "1" DOTNET_NOLOGO: "true" + GIT_DEPTH: "0" -image: mcr.microsoft.com/dotnet/sdk:8.0 +image: mcr.microsoft.com/dotnet/sdk:10.0 before_script: - dotnet --info @@ -23,17 +24,22 @@ build: publish_nuget: stage: publish - image: mcr.microsoft.com/dotnet/sdk:8.0 + image: mcr.microsoft.com/dotnet/sdk:10.0 variables: NUGET_SOURCE: "$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/nuget/index.json" - script: - - dotnet restore - - dotnet tool install --global GitVersion.Tool --version 5.13.0 || true - - export PATH="$PATH:~/.dotnet/tools" - - gitversion /output buildserver - - echo "GitVersion_NuGetVersionV2=$GitVersion_NuGetVersionV2" - - dotnet pack src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj -c Release -o nuget --no-build - - dotnet nuget push "nuget/*.nupkg" --source "$NUGET_SOURCE" --api-key "$CI_JOB_TOKEN" --skip-duplicate + script: | + dotnet restore + 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 5.13.0 || true + export PATH="$PATH:~/.dotnet/tools" + GITVER=$(gitversion /showvariable NuGetVersionV2) + echo "Raw version: $GITVER" + PACKAGE_VERSION=$(echo "$GITVER" | sed 's/[{}]//g' | 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 nuget push "nuget/*.nupkg" --source "$NUGET_SOURCE" --api-key "$CI_JOB_TOKEN" --skip-duplicate only: - main - master diff --git a/GitVersion.yml b/GitVersion.yml index a87f49f..c19b731 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -3,12 +3,10 @@ branches: main: regex: ^main$ increment: Minor - prevent-increment-of-merged-branch-version: true track-merge-target: false master: regex: ^master$ increment: Minor - prevent-increment-of-merged-branch-version: true track-merge-target: false feature: regex: ^(?:feat(?:ure)?|feature)[/\\-] diff --git a/src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj b/src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj index 9a793fd..8dbcfd1 100644 --- a/src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj +++ b/src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj @@ -11,8 +11,12 @@ Maddo Core library for AIFotoONLUS image processing and recognition. https://gitlab.com/MaddoScientisto/aifotoonlus - - $(GitVersion_NuGetVersionV2) + + $(GitVersion_NuGetVersionV2) + $([System.Text.RegularExpressions.Regex]::Replace('$(GitVersionRaw)','[{}]','')) + $(GitVersionSanitized) + 0.1.0 See Git history for release notes. true false @@ -22,7 +26,7 @@ - +