From 4262fd6d71386bd994256627d94e468988b363db Mon Sep 17 00:00:00 2001 From: Alessio Dal Santo Date: Fri, 20 Mar 2026 18:07:34 +0100 Subject: [PATCH] [Fix] Correzione versioning CI/CD: fetch completo storia Git per MinVer Aggiunto fetch-depth: 0 al checkout in tutti i job dei workflow GitHub Actions e Gitea Actions. Rimosso --depth 1 dal clone manuale del job Windows in Gitea. MinVer necessita della storia completa per risalire ai tag Git e calcolare la versione corretta. Senza questa correzione la versione risultava sempre 2.1.0 (fallback hardcoded). Aggiornato anche il valore di fallback da 2.1.0 a 2.3.2. --- .gitea/workflows/docker-build.yml | 8 +++++--- .github/workflows/docker-build.yml | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/docker-build.yml b/.gitea/workflows/docker-build.yml index 60c6976..d8faef3 100644 --- a/.gitea/workflows/docker-build.yml +++ b/.gitea/workflows/docker-build.yml @@ -30,6 +30,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 # Necessario per MinVer: deve percorrere tutta la storia Git per trovare i tag - name: Setup .NET uses: actions/setup-dotnet@v4 @@ -51,7 +53,7 @@ jobs: # Fallback if MinVer fails (no tags) if [ -z "$VERSION" ] || [ "$VERSION" = "0.0.0-alpha.0" ]; then echo "Warning: No git tags found. MinVer returned default. Using fallback." - VERSION="2.1.0-alpha.0.$(git rev-list --count HEAD)" + VERSION="2.3.2-alpha.0.$(git rev-list --count HEAD)" fi echo "MinVer calculated version: $VERSION" @@ -159,7 +161,7 @@ jobs: steps: - name: Checkout repository with Git run: | - git clone --depth 1 --branch ${{ github.ref_name }} https://alessio:%REGISTRY_TOKEN%@gitea.home-nas-ds.org/${{ github.repository }}.git . + git clone --branch ${{ github.ref_name }} https://alessio:%REGISTRY_TOKEN%@gitea.home-nas-ds.org/${{ github.repository }}.git . if not exist Dockerfile.windows ( echo ERROR: Dockerfile.windows not found exit /b 1 @@ -191,7 +193,7 @@ jobs: if ([string]::IsNullOrWhiteSpace($VERSION) -or $VERSION -eq "0.0.0-alpha.0") { Write-Host "Warning: No git tags found. MinVer returned default. Using fallback." $commitCount = git rev-list --count HEAD - $VERSION = "2.1.0-alpha.0.$commitCount" + $VERSION = "2.3.2-alpha.0.$commitCount" } Write-Host "MinVer calculated version: $VERSION" diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index d6c2cd9..0815628 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -31,6 +31,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 # Necessario per MinVer: deve percorrere tutta la storia Git per trovare i tag - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -95,6 +97,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 # Necessario per MinVer: deve percorrere tutta la storia Git per trovare i tag - name: Log in to GitHub Container Registry uses: docker/login-action@v3