Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix versioninfo #83

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@
"dotnet-csharpier"
],
"rollForward": false
},
"gitversion.tool": {
"version": "6.0.5",
"commands": [
"dotnet-gitversion"
],
"rollForward": false
}
}
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,5 @@ FodyWeavers.xsd
/Server/fracture.d*

# AssemblyInfo.cs (it's autogenerated)
/Server/AssemblyInfo.cs
/Server/AssemblyInfo.cs
version.txt
2 changes: 1 addition & 1 deletion Server/Components/Pages/GamePage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</div>
<div class="dialogueWindowBg">
<div class="dialogueWindow">
Fracture @VersionInfoProvider.ShortVersion<br />
Fracture @VersionInfoProvider.InformationalVersion<br />
tutaj log mojej gry<br />
<PopupContainer @ref="_popup"></PopupContainer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion Server/Fracture.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High" WorkingDirectory=".." />
</Target>
<Target Name="GitVersion" BeforeTargets="Build">
<Exec Command="dotnet dotnet-gitversion /updateassemblyinfo AssemblyInfo.cs /ensureassemblyinfo" StandardOutputImportance="High" StandardErrorImportance="High" />
<Exec Command="git rev-list --count HEAD > version.txt &amp;&amp; git rev-parse --abbrev-ref HEAD >> version.txt" StandardOutputImportance="High" StandardErrorImportance="High" />
</Target>
</Project>
10 changes: 3 additions & 7 deletions Server/Modules/Shared/VersionInfoProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ class VersionInfoProvider
{
public VersionInfoProvider()
{
InformationalVersion =
Assembly
.GetEntryAssembly()
?.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
?.InformationalVersion ?? string.Empty;

ShortVersion = InformationalVersion.Substring(0, InformationalVersion.IndexOf(".Branch"));
var lines = File.ReadAllLines("version.txt");
ShortVersion = lines[0];
InformationalVersion = $"{lines[0]}-{lines[1]}";
}

public string InformationalVersion { get; init; }
Expand Down
Loading