Switch to MinVer, add CI/CD, unify thumbnail options
- Add .gitlab-ci.yml for Windows CI/CD: build, publish, and GitLab Release with artifact upload - Replace GitVersion.MsBuild with MinVer for versioning; update all versioning logic in .csproj - Remove GitVersion CLI fallback for Visual Studio builds - Update post-publish renaming to use MinVer's Version property - Replace multiple thumbnail text checkboxes with a single ComboBox selector in MainWindow.xaml - Change default UI startup: prefer WPF MainWindow, fallback to WinForms MainForm
This commit is contained in:
parent
d13ec8abdf
commit
da9d9875b0
4 changed files with 94 additions and 45 deletions
55
.gitlab-ci.yml
Normal file
55
.gitlab-ci.yml
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- publish
|
||||||
|
|
||||||
|
variables:
|
||||||
|
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
|
||||||
|
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1"
|
||||||
|
BUILD_CONFIG: "Release"
|
||||||
|
|
||||||
|
# Build job for Windows runner (shell executor). Remove 'image' so the runner uses the host environment.
|
||||||
|
build_windows:
|
||||||
|
stage: build
|
||||||
|
tags:
|
||||||
|
- windows
|
||||||
|
script:
|
||||||
|
- dotnet --info
|
||||||
|
- dotnet restore
|
||||||
|
- dotnet build "imagecatalog\ImageCatalog 2.csproj" -c $BUILD_CONFIG -v minimal
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- "**/bin/$BUILD_CONFIG/net10.0-windows/**"
|
||||||
|
expire_in: 1 hour
|
||||||
|
|
||||||
|
# Publish and create GitLab Release when building a tag. This job expects a Windows runner with PowerShell and curl available.
|
||||||
|
publish_release:
|
||||||
|
stage: publish
|
||||||
|
tags:
|
||||||
|
- windows
|
||||||
|
needs:
|
||||||
|
- build_windows
|
||||||
|
script:
|
||||||
|
# Publish the app
|
||||||
|
- dotnet publish "imagecatalog\ImageCatalog 2.csproj" -c $BUILD_CONFIG -r win-x64 --self-contained false -o publish
|
||||||
|
- echo "Published to $(pwd)\\publish"
|
||||||
|
# Find first file in publish folder
|
||||||
|
- $file = Get-ChildItem -Path publish -File | Select-Object -First 1; Write-Host "Uploading $($file.FullName)"
|
||||||
|
# Upload to GitLab project uploads API to get a public URL for the artifact
|
||||||
|
- $uploadUrl = "$env:CI_API_V4_URL/projects/$env:CI_PROJECT_ID/uploads"
|
||||||
|
- $formData = "file=@$($file.FullName)"
|
||||||
|
- $uploadResp = curl --silent --show-error --header "JOB-TOKEN:$env:CI_JOB_TOKEN" --form $formData $uploadUrl
|
||||||
|
- $uploadJson = $uploadResp | ConvertFrom-Json
|
||||||
|
- $assetUrl = "$env:CI_SERVER_URL$($uploadJson.url)"
|
||||||
|
- 'Write-Host "Uploaded asset url: $assetUrl"'
|
||||||
|
# Create the release using uploads URL
|
||||||
|
- $body = @{ name = $env:CI_COMMIT_TAG; tag_name = $env:CI_COMMIT_TAG; description = "Automated release from CI"; assets = @{ links = @(@{ name = "$($file.Name)"; url = $assetUrl }) } } | ConvertTo-Json -Depth 10
|
||||||
|
- Invoke-RestMethod -Method Post -Uri "$env:CI_API_V4_URL/projects/$env:CI_PROJECT_ID/releases" -Headers @{ "JOB-TOKEN" = $env:CI_JOB_TOKEN } -Body $body -ContentType "application/json"
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- publish/*
|
||||||
|
expire_in: 1 day
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
|
||||||
|
# Notes for runner setup: Ensure a GitLab Windows runner with tag 'windows' is registered and has .NET 10 SDK installed.
|
||||||
|
# Use the shell executor on the Windows machine so the job runs in the host PowerShell environment
|
||||||
|
|
@ -46,21 +46,19 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.3" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.3" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.3" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.3" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.3" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.3" />
|
||||||
<PackageReference Include="GitVersion.MsBuild" Version="6.5.1" PrivateAssets="all" />
|
<PackageReference Include="MinVer" Version="3.0.0" PrivateAssets="all" />
|
||||||
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302">
|
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- If GitVersion ran and produced values, prefer them for assembly/file/informational version
|
<!-- If MinVer ran and produced values, prefer them for assembly/file/informational version
|
||||||
so the built assembly exposes FullSemVer for runtime and the publish rename uses the same value. -->
|
so the built assembly exposes the computed version for runtime and the publish rename uses the same value. -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- AssemblyVersion uses AssemblySemVer when available (three-part) -->
|
<!-- Prefer explicit MSBuild 'Version' set by MinVer when available -->
|
||||||
<AssemblyVersion Condition="'$(GitVersion_AssemblySemVer)' != ''">$(GitVersion_AssemblySemVer)</AssemblyVersion>
|
<AssemblyVersion Condition="'$(Version)' != ''">$(Version)</AssemblyVersion>
|
||||||
<!-- FileVersion uses GitVersion FileVersion when available -->
|
<FileVersion Condition="'$(Version)' != ''">$(Version)</FileVersion>
|
||||||
<FileVersion Condition="'$(GitVersion_FileVersion)' != ''">$(GitVersion_FileVersion)</FileVersion>
|
<InformationalVersion Condition="'$(Version)' != ''">$(Version)</InformationalVersion>
|
||||||
<!-- Prefer FullSemVer for informational version -->
|
|
||||||
<InformationalVersion Condition="'$(GitVersion_FullSemVer)' != ''">$(GitVersion_FullSemVer)</InformationalVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="Properties\Settings.Designer.cs">
|
<Compile Update="Properties\Settings.Designer.cs">
|
||||||
|
|
@ -76,18 +74,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
|
|
||||||
<!-- When building inside Visual Studio (which runs .NET Framework MSBuild), the GitVersion.MsBuild
|
<!-- No Visual Studio fallback required for MinVer; MinVer integrates with MSBuild during build. -->
|
||||||
task (net8.0) may fail. Run the GitVersion CLI as a fallback to produce obj/gitversion.json so
|
|
||||||
subsequent targets can consume the same values. Developers should install the global tool:
|
|
||||||
dotnet tool install __global GitVersion.Tool __version 6.5.1
|
|
||||||
-->
|
|
||||||
<Target Name="RunGitVersionCliForVisualStudio" BeforeTargets="GenerateAssemblyInfo" Condition="'$(BuildingInsideVisualStudio)' == 'true'">
|
|
||||||
<Message Text="Building inside Visual Studio: attempting to run GitVersion CLI to generate obj\gitversion.json (if `dotnet-gitversion` is installed)." Importance="High" />
|
|
||||||
<!-- Try the typical global tool command. ContinueOnError=true so VS build doesn't fail if CLI is not installed. -->
|
|
||||||
<Exec Command="dotnet-gitversion -output file -outputfile "$(ProjectDir)obj\gitversion.json"" ContinueOnError="true" />
|
|
||||||
<!-- Also try 'dotnet tool run' in case a local tool manifest is used. -->
|
|
||||||
<Exec Command="dotnet tool run GitVersion.Tool -- -output file -outputfile "$(ProjectDir)obj\gitversion.json"" ContinueOnError="true" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<!-- After publish, rename the produced executable to ImageCatalog.<year>.<major>.<minor>.<build>.<revision>.<ext>
|
<!-- After publish, rename the produced executable to ImageCatalog.<year>.<major>.<minor>.<build>.<revision>.<ext>
|
||||||
The destination extension is taken from the actual produced file (exe or dll).
|
The destination extension is taken from the actual produced file (exe or dll).
|
||||||
|
|
@ -95,9 +82,9 @@
|
||||||
<Target Name="RenamePublishedExeWithYearAndVersion" AfterTargets="Publish" Condition="'$(PublishDir)' != ''">
|
<Target Name="RenamePublishedExeWithYearAndVersion" AfterTargets="Publish" Condition="'$(PublishDir)' != ''">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<_PublishYear>$([System.DateTime]::Now.ToString("yyyy"))</_PublishYear>
|
<_PublishYear>$([System.DateTime]::Now.ToString("yyyy"))</_PublishYear>
|
||||||
<!-- Prefer GitVersion FullSemVer, then FileVersion, then AssemblyVersion -->
|
<!-- Prefer MinVer/MSBuild 'Version', then FileVersion, then AssemblyVersion -->
|
||||||
<_Ver Condition="'$(GitVersion_FullSemVer)' != ''">$(GitVersion_FullSemVer)</_Ver>
|
<_Ver Condition="'$(Version)' != ''">$(Version)</_Ver>
|
||||||
<_Ver Condition="'$(GitVersion_FullSemVer)' == ''">$(FileVersion)</_Ver>
|
<_Ver Condition="'$(Version)' == ''">$(FileVersion)</_Ver>
|
||||||
<_Ver Condition="'$(_Ver)' == ''">$(AssemblyVersion)</_Ver>
|
<_Ver Condition="'$(_Ver)' == ''">$(AssemblyVersion)</_Ver>
|
||||||
|
|
||||||
<!-- Normalize to avoid spaces but keep plus signs for pre-release build metadata; replace spaces with underscore -->
|
<!-- Normalize to avoid spaces but keep plus signs for pre-release build metadata; replace spaces with underscore -->
|
||||||
|
|
|
||||||
|
|
@ -196,11 +196,18 @@
|
||||||
<TextBox Text="{Binding ThumbnailWidth}" Width="80" />
|
<TextBox Text="{Binding ThumbnailWidth}" Width="80" />
|
||||||
<TextBox Text="{Binding ThumbnailHeight}" Width="80" Margin="8,0,0,0" />
|
<TextBox Text="{Binding ThumbnailHeight}" Width="80" Margin="8,0,0,0" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<CheckBox Content="Aggiungi testo alle miniature" IsChecked="{Binding AddTextToThumbnails}" Margin="0,8,0,0" />
|
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,6,0,0">
|
<!-- New unified thumbnail mode selector (Italian labels) -->
|
||||||
<CheckBox Content="Aggiungi numero e tempo" IsChecked="{Binding AddNumberAndTimeToThumbnails}" />
|
<StackPanel Orientation="Vertical" Margin="0,8,0,0">
|
||||||
<CheckBox Content="Aggiungi tempo alle miniature" IsChecked="{Binding AddTimeToThumbnails}" Margin="8,0,0,0" />
|
<TextBlock Text="Modalità miniature:" VerticalAlignment="Center" />
|
||||||
<CheckBox Content="Mostra nome file" IsChecked="{Binding ShowFileNameOnThumbnails}" Margin="8,0,0,0" />
|
<ComboBox SelectedIndex="{Binding ThumbnailOptionIndex, Mode=TwoWay}" Width="220" Margin="0,6,0,0">
|
||||||
|
<ComboBoxItem>Nessuna</ComboBoxItem>
|
||||||
|
<ComboBoxItem>Aggiungi scritta</ComboBoxItem>
|
||||||
|
<ComboBoxItem>Nome file</ComboBoxItem>
|
||||||
|
<ComboBoxItem>Aggiungi orario</ComboBoxItem>
|
||||||
|
<ComboBoxItem>Nome+Orario</ComboBoxItem>
|
||||||
|
<ComboBoxItem>Tempo gara</ComboBoxItem>
|
||||||
|
</ComboBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
|
||||||
|
|
@ -79,24 +79,24 @@ static class Program
|
||||||
// the block below and comment out the WPF branch.
|
// the block below and comment out the WPF branch.
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// // Force WinForms UI (uncomment to enable)
|
// // Force WinForms UI (uncomment to enable)
|
||||||
var mainForm = serviceProvider.GetRequiredService<MainForm>();
|
//var mainForm = serviceProvider.GetRequiredService<MainForm>();
|
||||||
// If you want to set the DataModel explicitly on the WinForms form use the lines below
|
//// If you want to set the DataModel explicitly on the WinForms form use the lines below
|
||||||
// var mainViewModel = serviceProvider.GetRequiredService<DataModel>();
|
//// var mainViewModel = serviceProvider.GetRequiredService<DataModel>();
|
||||||
// mainForm.Model = mainViewModel;
|
//// mainForm.Model = mainViewModel;
|
||||||
Application.Run(mainForm);
|
//Application.Run(mainForm);
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
//if (serviceProvider.GetService(typeof(ImageCatalog_2.MainWindow)) is ImageCatalog_2.MainWindow wpfMain)
|
if (serviceProvider.GetService(typeof(ImageCatalog_2.MainWindow)) is ImageCatalog_2.MainWindow wpfMain)
|
||||||
//{
|
{
|
||||||
// // Start WPF app
|
// Start WPF app
|
||||||
// var app = new System.Windows.Application();
|
var app = new System.Windows.Application();
|
||||||
// app.Run(wpfMain);
|
app.Run(wpfMain);
|
||||||
//}
|
}
|
||||||
//else
|
else
|
||||||
//{
|
{
|
||||||
// var mainForm = serviceProvider.GetRequiredService<MainForm>();
|
var mainForm = serviceProvider.GetRequiredService<MainForm>();
|
||||||
// Application.Run(mainForm);
|
Application.Run(mainForm);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue