1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Core - Changed version format

This commit is contained in:
Diogo Trindade 2022-09-30 21:47:32 +01:00 committed by RobertBeekman
parent 45f9a80d77
commit 3758275b71
4 changed files with 9 additions and 10 deletions

View File

@ -10,7 +10,7 @@ jobs:
version:
runs-on: ubuntu-latest
outputs:
version-suffix: ${{ steps.get-version.outputs.version-suffix }}
version-number: ${{ steps.get-version.outputs.version-number }}
steps:
- name: Checkout
uses: actions/checkout@v3
@ -21,10 +21,10 @@ jobs:
shell: pwsh
run: |
$MidnightUtc = [DateTime]::UtcNow.Date
$BranchName = "${{ github.ref_name }}".replace('/','-').replace('.','-')
$ApiVersion = (Select-Xml -Path 'src/Artemis.Core/Artemis.Core.csproj' -XPath '//PluginApiVersion').Node.InnerText
$NumberOfCommitsToday = (git log --after=$($MidnightUtc.ToString("o")) --oneline | Measure-Object -Line).Lines
$VersionSuffix = "$BranchName.$($MidnightUtc.ToString("yyyyMMdd")).$NumberOfCommitsToday"
Write-Output "::set-output name=version-suffix::$VersionSuffix"
$VersionNumber = "$ApiVersion.$($MidnightUtc.ToString("yyyy.MMdd")).$NumberOfCommitsToday"
Write-Output "::set-output name=version-number::$VersionNumber"
nuget:
name: Publish Nuget Packages
@ -38,8 +38,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Pack Artemis.Core
run: dotnet pack -c Release -p:VersionSuffix=${{ needs.version.outputs.version-suffix }} -p:BuildingNuget=True src/Artemis.Core/Artemis.Core.csproj
run: dotnet pack -c Release -p:Version=${{ needs.version.outputs.version-number }} -p:BuildingNuget=True src/Artemis.Core/Artemis.Core.csproj
- name: Pack Artemis.UI.Shared
run: dotnet pack -c Release -p:VersionSuffix=${{ needs.version.outputs.version-suffix }} src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
run: dotnet pack -c Release -p:Version=${{ needs.version.outputs.version-number }} src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
- name: Push Nugets
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

View File

@ -10,8 +10,7 @@
<Platforms>x64</Platforms>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>ArtemisRGB.Core</PackageId>
<!-- API Version -->
<VersionPrefix>1.0.0.0</VersionPrefix>
<PluginApiVersion>1</PluginApiVersion>
</PropertyGroup>
<ItemGroup>

View File

@ -61,7 +61,7 @@ public static class Constants
/// <summary>
/// The current API version for plugins
/// </summary>
public static readonly Version PluginApi = CoreAssembly.GetName().Version!;
public static readonly int PluginApiVersion = CoreAssembly.GetName().Version.Major;
/// <summary>
/// The plugin info used by core components of Artemis

View File

@ -191,7 +191,7 @@ public class PluginInfo : CorePropertyChanged, IPrerequisitesSubject
/// <summary>
/// Gets a boolean indicating whether this plugin is compatible with the current operating system and API version
/// </summary>
public bool IsCompatible => Platforms.MatchesCurrentOperatingSystem() && Api != null && Api >= Constants.PluginApi;
public bool IsCompatible => Platforms.MatchesCurrentOperatingSystem() && Api != null && Api.Major >= Constants.PluginApiVersion;
internal string PreferredPluginDirectory => $"{Main.Split(".dll")[0].Replace("/", "").Replace("\\", "")}-{Guid.ToString().Substring(0, 8)}";