Adds gitversioning for releases (#209)

This commit is contained in:
Kamron Batman 2020-09-02 17:50:57 -07:00 committed by GitHub
parent 584d4bc1d9
commit 192cf70d20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 82 additions and 58 deletions

View file

@ -10,25 +10,21 @@ jobs:
if: "contains(github.event.head_commit.message, 'Release')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.401
- name: Get Project Version
id: get-version
uses: mavrosxristoforos/get-xml-info@1.0
with:
xml-file: 'Directory.Build.props'
xpath: '/Project/PropertyGroup/Version'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: dotnet/nbgv@master
id: nbgv
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.get-version.output.info }}
release_name: ${{ steps.get-version.output.info }}
tag_name: ${{ steps.nbgv.outputs.Version }}
release_name: ${{ steps.nbgv.outputs.Version }}
draft: false
prerelease: false
env:
@ -36,30 +32,30 @@ jobs:
- name: Build Windows
run: ./publish.cmd win core Release
- name: Create Windows Artifact
run: rm -rf ./Projects/*/bin && rm -rf ./Projects/*/obj && zip -r modernuo-win-x64-${{ steps.get-version.output.info }}.zip ./*
run: rm -rf ./Projects/*/bin && rm -rf ./Projects/*/obj && zip -r modernuo-win-x64-${{ steps.nbgv.outputs.Version }}.zip ./*
- name: Upload Windows Build
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./modernuo-win-x64-${{ steps.get-version.output.info }}.zip
asset_name: modernuo-win-x64-${{ steps.get-version.output.info }}.zip
asset_path: ./modernuo-win-x64-${{ steps.nbgv.outputs.Version }}.zip
asset_name: modernuo-win-x64-${{ steps.nbgv.outputs.Version }}.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clean Windows Build
run: rm modernuo-win-x64-${{ steps.get-version.output.info }}.zip
run: rm modernuo-win-x64-${{ steps.nbgv.outputs.Version }}.zip
- name: Build Ubuntu 18 LTS
run: ./publish.cmd ubuntu.18.04 core Release
- name: Create Ubuntu 18 LTS Artifact
run: rm -rf ./Projects/*/bin && rm -rf ./Projects/*/obj && zip -r ubuntu.18.04-x64-${{ steps.get-version.output.info }}.zip ./*
run: rm -rf ./Projects/*/bin && rm -rf ./Projects/*/obj && zip -r ubuntu.18.04-x64-${{ steps.nbgv.outputs.Version }}.zip ./*
- name: Upload Ubuntu 18 LTS Build
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./modernuo-ubuntu.18.04-x64-${{ steps.get-version.output.info }}.zip
asset_name: modernuo-ubuntu.18.04-x64-${{ steps.get-version.output.info }}.zip
asset_path: ./modernuo-ubuntu.18.04-x64-${{ steps.nbgv.outputs.Version }}.zip
asset_name: modernuo-ubuntu.18.04-x64-${{ steps.nbgv.outputs.Version }}.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clean Ubuntu 18 LTS Build
run: rm modernuo-ubuntu.18.04-x64-${{ steps.get-version.output.info }}.zip
run: rm modernuo-ubuntu.18.04-x64-${{ steps.nbgv.outputs.Version }}.zip

View file

@ -17,6 +17,8 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:

View file

@ -7,8 +7,8 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<Platforms>x64</Platforms>
<PlatformTarget>x64</PlatformTarget>
<Version>0.6.1</Version>
<LangVersion>8.0</LangVersion>
<PublicRelease>true</PublicRelease>
<DefineConstants Condition="$(RuntimeIdentifier.StartsWith('win'))">WINDOWS</DefineConstants>
<DefineConstants Condition="$(RuntimeIdentifier.StartsWith(`win`)) != true">UNIX</DefineConstants>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

View file

@ -119,7 +119,11 @@ namespace Server
public static Assembly Assembly { get; set; }
public static Version Version => Assembly.GetName().Version;
// Assembly file version
public static Version Version => Version.Parse(
FileVersionInfo.GetVersionInfo(Assembly.Location).FileVersion
);
public static Process Process { get; private set; }
public static Thread Thread { get; private set; }
@ -354,16 +358,14 @@ namespace Server
if (BaseDirectory.Length > 0)
Directory.SetCurrentDirectory(BaseDirectory);
var ver = Assembly.GetName().Version ?? new Version();
Utility.PushColor(ConsoleColor.Green);
// Added to help future code support on forums, as a 'check' people can ask for to it see if they recompiled core or not
Console.WriteLine(
"ModernUO - [https://github.com/modernuo/modernuo] Version {0}.{1}.{2}.{3}",
ver.Major,
ver.Minor,
ver.Build,
ver.Revision
Version.Major,
Version.Minor,
Version.Build,
Version.Revision
);
Console.WriteLine("Core: Running on {0}\n", RuntimeInformation.FrameworkDescription);
Utility.PopColor();

View file

@ -61,6 +61,10 @@
<PackageReference Include="Microsoft.AspNetCore.Connections.Abstractions" Version="3.1.5" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.1.5" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.2.31">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.IO.Pipelines" Version="4.7.2" />
<PackageReference Include="Zlib.Bindings" Version="1.2.0" />
</ItemGroup>

View file

@ -36,6 +36,12 @@
"Microsoft.Extensions.Logging.Abstractions": "3.1.5"
}
},
"Nerdbank.GitVersioning": {
"type": "Direct",
"requested": "[3.2.31, )",
"resolved": "3.2.31",
"contentHash": "19grBnpqHLxViOt1cwE+cI+brQ2swdm4gfM97P+9KbbgWGfXtdy4EmpVAkUZ3MgntFYYbUvfldM4pUOmks5q0w=="
},
"System.IO.Pipelines": {
"type": "Direct",
"requested": "[4.7.2, )",

View file

@ -58,6 +58,10 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.5" />
<!-- Direct packages -->
<PackageReference Include="MailKit" Version="2.8.0" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.2.31">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Zlib.Bindings" Version="1.2.0" />
<PackageReference Include="Argon2.Bindings" Version="1.6.0" />
</ItemGroup>

View file

@ -54,6 +54,12 @@
"resolved": "3.1.5",
"contentHash": "ZvwowjRSWXewdPI+whPFXgwF4Qme6Q9KV9SCPEITSGiqHLArct7q5hTBtTzj3GPsVLjTqehvTg6Bd/EQk9JS0A=="
},
"Nerdbank.GitVersioning": {
"type": "Direct",
"requested": "[3.2.31, )",
"resolved": "3.2.31",
"contentHash": "19grBnpqHLxViOt1cwE+cI+brQ2swdm4gfM97P+9KbbgWGfXtdy4EmpVAkUZ3MgntFYYbUvfldM4pUOmks5q0w=="
},
"Zlib.Bindings": {
"type": "Direct",
"requested": "[1.2.0, )",

4
version.json Normal file
View file

@ -0,0 +1,4 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.6.1"
}