[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.
This commit is contained in:
@@ -30,6 +30,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # Necessario per MinVer: deve percorrere tutta la storia Git per trovare i tag
|
||||||
|
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v4
|
uses: actions/setup-dotnet@v4
|
||||||
@@ -51,7 +53,7 @@ jobs:
|
|||||||
# Fallback if MinVer fails (no tags)
|
# Fallback if MinVer fails (no tags)
|
||||||
if [ -z "$VERSION" ] || [ "$VERSION" = "0.0.0-alpha.0" ]; then
|
if [ -z "$VERSION" ] || [ "$VERSION" = "0.0.0-alpha.0" ]; then
|
||||||
echo "Warning: No git tags found. MinVer returned default. Using fallback."
|
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
|
fi
|
||||||
|
|
||||||
echo "MinVer calculated version: $VERSION"
|
echo "MinVer calculated version: $VERSION"
|
||||||
@@ -159,7 +161,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repository with Git
|
- name: Checkout repository with Git
|
||||||
run: |
|
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 (
|
if not exist Dockerfile.windows (
|
||||||
echo ERROR: Dockerfile.windows not found
|
echo ERROR: Dockerfile.windows not found
|
||||||
exit /b 1
|
exit /b 1
|
||||||
@@ -191,7 +193,7 @@ jobs:
|
|||||||
if ([string]::IsNullOrWhiteSpace($VERSION) -or $VERSION -eq "0.0.0-alpha.0") {
|
if ([string]::IsNullOrWhiteSpace($VERSION) -or $VERSION -eq "0.0.0-alpha.0") {
|
||||||
Write-Host "Warning: No git tags found. MinVer returned default. Using fallback."
|
Write-Host "Warning: No git tags found. MinVer returned default. Using fallback."
|
||||||
$commitCount = git rev-list --count HEAD
|
$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"
|
Write-Host "MinVer calculated version: $VERSION"
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
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
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
@@ -95,6 +97,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
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
|
- name: Log in to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
|
|||||||
Reference in New Issue
Block a user