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

Gitversion #23

Merged
merged 14 commits into from
Aug 18, 2024
29 changes: 21 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Build & Release

on:
push:
branches: "master"
branches:
- "master"
paths-ignore:
- '**/README.md'
tags:
Expand All @@ -11,8 +12,7 @@ on:
branches: "*"
paths-ignore:
- '**/README.md'



env:
DOTNET_NOLOGO: false
DOTNET_CLI_TELEMETRY_OPTOUT: 1
Expand All @@ -30,17 +30,31 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '6.x'
- name: Execute GitVersion
id: executeGitVersion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: 'true'
updateAssemblyInfo: 'true'
updateAssemblyInfoFilename: "${{ matrix.project.name }}/AssemblyInfo.cs"
- name: Publish
run: dotnet publish ${{ matrix.project.name }} -c Release -o release_${{ matrix.project.name }} -p:DebugType=None ${{ matrix.project.extraArgs }}
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.project.name }}-${{ runner.os }}-${{ runner.arch }}
path: ${{ github.workspace }}/release_${{ matrix.project.name }}/*
outputs:
semVer: ${{ steps.executeGitVersion.outputs.assemblySemVer }}

release:
runs-on: ubuntu-latest
Expand All @@ -62,24 +76,23 @@ jobs:
zip -qq -r release/Cedserver-$arch-x64.zip artifacts/Server-$arch-X64/
zip -qq -r release/CentrED-$arch-x64.zip artifacts/CentrED-$arch-X64/
done

- name: Create Release
uses: ncipollo/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
artifacts: release/*
generateReleaseNotes: true
skipIfReleaseExists: true
tag: ${{ needs.build.outputs.semVer }}

- name: Create Dev Release
- name: Create Pre-Release
uses: ncipollo/[email protected]
if: github.ref == 'refs/heads/master'
with:
allowUpdates: true
artifacts: release/*
generateReleaseNotes: false
makeLatest: true
prerelease: true
replacesArtifacts: true
tag: dev
tag: ${{ needs.build.outputs.semVer }}

12 changes: 12 additions & 0 deletions CentrED/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Reflection;

[assembly: AssemblyFileVersion("0.0.2.0")]
[assembly: AssemblyVersion("0.0.2.0")]

[assembly: AssemblyTitle("CentrED")]
[assembly: AssemblyDescription("CentrED Application")]

[assembly: AssemblyCompany("Nelderim")]
[assembly: AssemblyProduct("Centred#")]

[assembly: AssemblyInformationalVersion("0.0.1+Branch.gitversion.Sha.0ee65457e499fadc5fd917bf211b8e3ceacac803")]
2 changes: 1 addition & 1 deletion CentrED/CentrED.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

<EnableSingleFileAnalysis>true</EnableSingleFileAnalysis>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
Expand Down
5 changes: 4 additions & 1 deletion CentrED/CentrEDGame.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Reflection;
using CentrED.Map;
using CentrED.UI;
using ClassicUO.Utility.Logging;
Expand Down Expand Up @@ -29,7 +30,9 @@ public CentrEDGame()
e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage =
RenderTargetUsage.DiscardContents;
};

var assName = Assembly.GetExecutingAssembly().GetName();
Window.Title = $"{assName.Name} {assName.Version}";

IsMouseVisible = true;
Window.AllowUserResizing = true;
Window.ClientSizeChanged += OnWindowResized;
Expand Down
12 changes: 12 additions & 0 deletions Client/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Reflection;

[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyVersion("0.0.1.0")]

[assembly: AssemblyTitle("CentrED Client")]
[assembly: AssemblyDescription("CentrED Client")]

[assembly: AssemblyCompany("Nelderim")]
[assembly: AssemblyProduct("Centred#Client")]

[assembly: AssemblyInformationalVersion("0.0.1+Branch.gitversion.Sha.0ee65457e499fadc5fd917bf211b8e3ceacac803")]
1 change: 1 addition & 0 deletions Client/Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>CentrED.Client</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
Expand Down
167 changes: 167 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
assembly-versioning-format: '{Major}.{Minor}.{Patch}.{CommitsSinceVersionSource ?? 0}'
assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{CommitsSinceVersionSource ?? 0}'
tag-prefix: '[vV]?'
version-in-branch-pattern: (?<version>[vV]?\d+(\.\d+)?(\.\d+)?).*
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
tag-pre-release-weight: 60000
commit-date-format: yyyy-MM-dd
merge-message-formats: {}
update-build-number: true
semantic-version-format: Strict
strategies:
- Fallback
- ConfiguredNextVersion
- MergeMessage
- TaggedCommit
- TrackReleaseBranches
- VersionInBranchName
branches:
develop:
mode: ContinuousDelivery
label: alpha
increment: Minor
prevent-increment:
when-current-commit-tagged: false
track-merge-target: true
track-merge-message: true
regex: ^dev(elop)?(ment)?$
source-branches:
- main
is-source-branch-for: []
tracks-release-branches: true
is-release-branch: false
is-main-branch: false
pre-release-weight: 0
main:
label: ''
increment: Patch
prevent-increment:
of-merged-branch: true
track-merge-target: false
track-merge-message: true
regex: ^master$|^main$
source-branches: []
is-source-branch-for: []
tracks-release-branches: false
is-release-branch: false
is-main-branch: true
pre-release-weight: 55000
release:
mode: ManualDeployment
label: beta
increment: Minor
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
track-merge-target: false
regex: ^releases?[/-](?<BranchName>.+)
source-branches:
- main
- support
is-source-branch-for: []
tracks-release-branches: false
is-release-branch: true
is-main-branch: false
pre-release-weight: 30000
feature:
mode: ManualDeployment
label: '{BranchName}'
increment: Inherit
prevent-increment:
when-current-commit-tagged: false
track-merge-message: true
regex: ^features?[/-](?<BranchName>.+)
source-branches:
- develop
- main
- release
- support
- hotfix
is-source-branch-for: []
is-main-branch: false
pre-release-weight: 30000
pull-request:
mode: ContinuousDelivery
label: PullRequest
increment: Inherit
prevent-increment:
of-merged-branch: true
when-current-commit-tagged: false
label-number-pattern: '[/-](?<number>\d+)'
track-merge-message: true
regex: ^(pull|pull\-requests|pr)[/-]
source-branches:
- develop
- main
- release
- feature
- support
- hotfix
is-source-branch-for: []
pre-release-weight: 30000
hotfix:
mode: ManualDeployment
label: beta
increment: Inherit
prevent-increment:
when-current-commit-tagged: false
regex: ^hotfix(es)?[/-](?<BranchName>.+)
source-branches:
- main
- support
is-source-branch-for: []
is-release-branch: true
is-main-branch: false
pre-release-weight: 30000
support:
label: ''
increment: Patch
prevent-increment:
of-merged-branch: true
track-merge-target: false
regex: ^support[/-](?<BranchName>.+)
source-branches:
- main
is-source-branch-for: []
tracks-release-branches: false
is-release-branch: false
is-main-branch: true
pre-release-weight: 55000
unknown:
mode: ManualDeployment
label: '{BranchName}'
increment: Inherit
prevent-increment:
when-current-commit-tagged: true
regex: (?<BranchName>.+)
source-branches:
- main
- develop
- release
- feature
- pull-request
- hotfix
- support
is-source-branch-for: []
is-main-branch: false
ignore:
sha: []
mode: ContinuousDelivery
label: '{BranchName}'
increment: Inherit
prevent-increment:
of-merged-branch: false
when-branch-merged: false
when-current-commit-tagged: true
track-merge-target: false
track-merge-message: true
commit-message-incrementing: Enabled
regex: ''
source-branches: []
is-source-branch-for: []
tracks-release-branches: false
is-release-branch: false
is-main-branch: false
7 changes: 5 additions & 2 deletions Server/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ public class Application
{
public static void Main(string[] args)
{
Console.WriteLine($"CentrED# Server Version {Assembly.GetExecutingAssembly().GetName().Version}");
Console.WriteLine("Copyright " + Constants.Assembly.Copyright);
var assemblyName = Assembly.GetExecutingAssembly().GetName();
var title = $"{assemblyName.Name} {assemblyName.Version}";
Console.Title = title;
Console.WriteLine(title);
Console.WriteLine("Copyright 2024 Kaczy" );
Console.WriteLine("Credits to Andreas Schneider, StaticZ");
try
{
Expand Down
44 changes: 7 additions & 37 deletions Server/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,45 +1,15 @@
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyVersion(CentrED.Server.Constants.Assembly.Version)]
[assembly: AssemblyFileVersion(CentrED.Server.Constants.Assembly.Version)]
[assembly: AssemblyVersion("0.0.1.0")]
[assembly: AssemblyFileVersion("0.0.1.0")]

[assembly: AssemblyTitle(CentrED.Server.Constants.Assembly.Title)]
[assembly: AssemblyDescription(CentrED.Server.Constants.Assembly.Description)]
[assembly: AssemblyTitle("Cedserver")]
[assembly: AssemblyDescription("CentrED Server")]

[assembly: AssemblyCompany(CentrED.Server.Constants.Assembly.Company)]
[assembly: AssemblyProduct(CentrED.Server.Constants.Assembly.Product)]

[assembly: AssemblyCopyright(CentrED.Server.Constants.Assembly.Copyright)]
[assembly: AssemblyTrademark(CentrED.Server.Constants.Assembly.Trademark)]

[assembly: AssemblyCulture(CentrED.Server.Constants.Assembly.Culture)]
[assembly: AssemblyConfiguration(CentrED.Server.Constants.Assembly.Config)]
[assembly: AssemblyCompany("Nelderim")]
[assembly: AssemblyProduct("Cedserver#")]

[assembly: ComVisible(false)]
[assembly: Guid("beafea65-f3d3-446c-b944-8d4445e735c4")]

namespace CentrED.Server
{
public static class Constants
{
public const string Website = "https://kaczy93.github.io/centredsharp/";

public static class Assembly
{
public const string Version = "0.1.0.0";

public const string Title = "Cedserver";
public const string Description = "CentrED Server";

public const string Company = "Nelderim";
public const string Product = "Cedserver#";

public const string Copyright = "2023 Kaczy";
public const string Trademark = "";

public const string Culture = "";
public const string Config = "";
}
}
}
[assembly: AssemblyInformationalVersion("0.0.1+Branch.gitversion.Sha.0ee65457e499fadc5fd917bf211b8e3ceacac803")]
12 changes: 12 additions & 0 deletions Shared/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Reflection;

[assembly: AssemblyFileVersion("0.0.2.0")]
[assembly: AssemblyVersion("0.0.2.0")]

[assembly: AssemblyTitle("CentrEDLib")]
[assembly: AssemblyDescription("CentrED Shared Library")]

[assembly: AssemblyCompany("Nelderim")]
[assembly: AssemblyProduct("Centred#Lib")]

[assembly: AssemblyInformationalVersion("0.0.1+Branch.gitversion.Sha.0ee65457e499fadc5fd917bf211b8e3ceacac803")]
1 change: 1 addition & 0 deletions Shared/Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<LangVersion>11</LangVersion>
<AssemblyName>centredlib</AssemblyName>
<RootNamespace>CentrED</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading