From 3758275b712d63998c1ab9342073b7fd32e36b72 Mon Sep 17 00:00:00 2001 From: Diogo Trindade Date: Fri, 30 Sep 2022 21:47:32 +0100 Subject: [PATCH] Core - Changed version format --- .github/workflows/nuget.yml | 12 ++++++------ src/Artemis.Core/Artemis.Core.csproj | 3 +-- src/Artemis.Core/Constants.cs | 2 +- src/Artemis.Core/Plugins/PluginInfo.cs | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml index 0522d3f3a..2ee196d62 100644 --- a/.github/workflows/nuget.yml +++ b/.github/workflows/nuget.yml @@ -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 \ No newline at end of file diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj index 801bebb44..a7ec57544 100644 --- a/src/Artemis.Core/Artemis.Core.csproj +++ b/src/Artemis.Core/Artemis.Core.csproj @@ -10,8 +10,7 @@ x64 true ArtemisRGB.Core - - 1.0.0.0 + 1 diff --git a/src/Artemis.Core/Constants.cs b/src/Artemis.Core/Constants.cs index e745c8cc3..e57b947e4 100644 --- a/src/Artemis.Core/Constants.cs +++ b/src/Artemis.Core/Constants.cs @@ -61,7 +61,7 @@ public static class Constants /// /// The current API version for plugins /// - public static readonly Version PluginApi = CoreAssembly.GetName().Version!; + public static readonly int PluginApiVersion = CoreAssembly.GetName().Version.Major; /// /// The plugin info used by core components of Artemis diff --git a/src/Artemis.Core/Plugins/PluginInfo.cs b/src/Artemis.Core/Plugins/PluginInfo.cs index bcc988891..43b8319c0 100644 --- a/src/Artemis.Core/Plugins/PluginInfo.cs +++ b/src/Artemis.Core/Plugins/PluginInfo.cs @@ -191,7 +191,7 @@ public class PluginInfo : CorePropertyChanged, IPrerequisitesSubject /// /// Gets a boolean indicating whether this plugin is compatible with the current operating system and API version /// - 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)}";