From 1a9491617a57ae56d0d36971aa191e7628a915ef Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sun, 15 Feb 2026 21:30:01 +0100 Subject: [PATCH] Removed gitversion, added minversion --- .gitlab-ci.yml | 36 ++++++++++++-------- GitVersion.yml | 20 ----------- src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj | 15 +++----- 3 files changed, 26 insertions(+), 45 deletions(-) delete mode 100644 GitVersion.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 911bb27..f695285 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,13 @@ stages: - build - publish +# Only create pipelines automatically when a Git tag is pushed. +# Otherwise the pipeline must be started manually (pipeline "Run" / dispatch equivalent). +workflow: + rules: + - if: '$CI_COMMIT_TAG' + when: always + variables: DOTNET_CLI_TELEMETRY_OPTOUT: "1" DOTNET_NOLOGO: "true" @@ -34,19 +41,18 @@ 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:$HOME/.dotnet/tools" - - # 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") - PR=$(dotnet-gitversion /showvariable PreReleaseNumber 2>/dev/null || gitversion /showvariable PreReleaseNumber 2>/dev/null || echo "0") - 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 --no-build /p:PackageVersion="$PACKAGE_VERSION" /p:Version="$PACKAGE_VERSION" /p:EnableWindowsTargeting=true + + # If build was triggered by a Git tag, use that tag as the package version (strip leading 'v'). + # Otherwise rely on MinVer inside the project to infer a semantic version from git history. + if [ -n "$CI_COMMIT_TAG" ]; then + PACKAGE_VERSION="${CI_COMMIT_TAG#v}" + echo "Using tag version: $PACKAGE_VERSION" + dotnet pack src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj -c Release -o nuget --no-build /p:PackageVersion="$PACKAGE_VERSION" /p:EnableWindowsTargeting=true + else + echo "No tag detected; using MinVer to infer version at pack time" + dotnet pack src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj -c Release -o nuget --no-build /p:EnableWindowsTargeting=true + fi + dotnet nuget push "nuget/*.nupkg" --source "$NUGET_SOURCE" --api-key "$CI_JOB_TOKEN" --skip-duplicate - only: - - main - - master - - tags + # Pipeline creation is controlled by the top-level `workflow` rules. + # This job will run when the pipeline is created for a tag or when manually started. diff --git a/GitVersion.yml b/GitVersion.yml deleted file mode 100644 index c19b731..0000000 --- a/GitVersion.yml +++ /dev/null @@ -1,20 +0,0 @@ -mode: ContinuousDelivery -branches: - main: - regex: ^main$ - increment: Minor - track-merge-target: false - master: - regex: ^master$ - increment: Minor - track-merge-target: false - feature: - regex: ^(?:feat(?:ure)?|feature)[/\\-] - increment: Minor - source-branches: ["main", "master"] - hotfix: - regex: ^hotfix[/\\-] - increment: Patch -ignore: - sha: [] -commit-message-incrementing: Enabled \ No newline at end of file diff --git a/src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj b/src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj index 99a3eeb..c5f3f96 100644 --- a/src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj +++ b/src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj @@ -11,14 +11,9 @@ Maddo Core library for AIFotoONLUS image processing and recognition. https://gitlab.com/MaddoScientisto/aifotoonlus - - - $(GitVersion_MajorMinorPatch)-$(GitVersion_EscapedBranchName).$(GitVersion_PreReleaseNumber) - $(GitVersion_NuGetVersionV2) - $([System.Text.RegularExpressions.Regex]::Replace('$(GitVersionRaw)','[{}]','')) - $(GitVersionSanitized) - 0.1.0 + + 0.1.0 See Git history for release notes. true false @@ -27,8 +22,8 @@ - - + +