feat: Implementato sistema di versioning automatizzato con MinVer e Gitea Actions
Build and Push Docker Images / Build Linux Container (push) Successful in 6m54s
Build and Push Docker Images / Build Windows Container (push) Has been cancelled
Build and Push Docker Images / Create Multi-Platform Manifest (push) Has been cancelled

- Aggiunto MinVer per calcolo automatico versione da git tags
- Creato modello VersionInfo e servizio VersionService
- Integrato display versione nel NavMenu (Data_Coupler v2.1.0)
- Aggiornato workflow Gitea Actions (Linux e Windows) per generare version.json
- Risolto problema inconsistenza versioning tra container Linux e Windows
- Documentazione completa: VERSIONING_SYSTEM.md e MINVER_SETUP.md
- Versione ora calcolata automaticamente da git tags (Semantic Versioning)
This commit was merged in pull request #10.
This commit is contained in:
Alessio Dal Santo
2026-02-02 12:00:05 +01:00
parent 81fce773a9
commit ae16f99776
12 changed files with 1585 additions and 3 deletions
+89
View File
@@ -31,6 +31,47 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Generate version.json with MinVer
run: |
# Fetch all tags for MinVer to work correctly
git fetch --tags --force
# Build project to trigger MinVer (calcola versione automaticamente)
cd Data_Coupler
dotnet build -c Release /p:ContinuousIntegrationBuild=true
# Extract version calculated by MinVer from build output
VERSION=$(dotnet msbuild -getProperty:Version -p:ContinuousIntegrationBuild=true 2>/dev/null | tail -1)
# 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)"
fi
echo "MinVer calculated version: $VERSION"
# Create version.json
cat > wwwroot/version.json <<EOF
{
"version": "${VERSION}",
"commitSha": "${GITHUB_SHA:0:7}",
"branch": "${GITHUB_REF_NAME}",
"buildDate": "$(date -u +"%Y-%m-%d %H:%M:%S UTC")",
"buildEnvironment": "Gitea Actions"
}
EOF
echo "Generated version.json:"
cat wwwroot/version.json
cd ..
shell: bash
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@@ -127,6 +168,54 @@ jobs:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
shell: cmd
- name: Setup .NET
run: |
# .NET should already be available on Windows runner
dotnet --version
shell: pwsh
- name: Generate version.json with MinVer
run: |
# Fetch all tags for MinVer to work correctly
git fetch --tags --force
# Build project to trigger MinVer
cd Data_Coupler
dotnet build -c Release /p:ContinuousIntegrationBuild=true
# Extract version calculated by MinVer
$VERSION = dotnet msbuild -getProperty:Version -p:ContinuousIntegrationBuild=true 2>$null | Select-Object -Last 1
# Fallback if MinVer fails (no tags)
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"
}
Write-Host "MinVer calculated version: $VERSION"
$COMMIT_SHA = "${{ github.sha }}"
$SHORT_SHA = $COMMIT_SHA.Substring(0, 7)
$BRANCH = "${{ github.ref_name }}"
$BUILD_DATE = (Get-Date).ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss UTC")
# Create version.json
$versionJson = @{
version = $VERSION
commitSha = $SHORT_SHA
branch = $BRANCH
buildDate = $BUILD_DATE
buildEnvironment = "Gitea Actions"
} | ConvertTo-Json
$versionJson | Out-File -FilePath "wwwroot\version.json" -Encoding UTF8
Write-Host "Generated version.json:"
Get-Content "wwwroot\version.json"
cd ..
shell: pwsh
- name: Debug - Verify files
run: |
echo Working directory: