diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index ec79f15682..3d9360c02b 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -13,6 +13,12 @@ "commands": [ "husky" ] + }, + "minver-cli": { + "version": "5.0.0", + "commands": [ + "minver" + ] } } } \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3c046ed8c1..3a0b674e8c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,6 +13,9 @@ jobs: build-and-publish: runs-on: windows-latest + env: + VERSION: 3.0.0-alpha1 + steps: - name: Checkout uses: actions/checkout@v4 @@ -34,6 +37,9 @@ jobs: - name: Format run: ./build.ps1 format + - name: Version + run: ./build.ps1 version + - name: Restore run: ./build.ps1 restore diff --git a/Build/Program.cs b/Build/Program.cs index 09f7565274..b4a9581726 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -15,6 +15,7 @@ const string FORMAT = "format"; const string ZIP = "zip"; const string BUILD_INSTALLERS = "build-installers"; +const string VERSION = "version"; var arguments = new List(); if (args.Length > 1) @@ -49,7 +50,15 @@ void RemoveDirectory(string d) } } ); - +Target( + VERSION, + async () => + { + var (output, _) = await ReadAsync("dotnet", "minver -v w").ConfigureAwait(false); + Console.WriteLine($"Version: {output}"); + Environment.SetEnvironmentVariable("VERSION", output); + } +); Target( FORMAT, () => @@ -73,7 +82,9 @@ void RemoveDirectory(string d) Consts.Solutions, s => { - Run("msbuild", $"{s} /p:Configuration=Release /p:IsDesktopBuild=false /p:NuGetRestorePackages=false -v:m"); + var version = Environment.GetEnvironmentVariable("VERSION"); + Console.WriteLine($"Version: {version}"); + Run("msbuild", $"{s} /p:Configuration=Release /p:IsDesktopBuild=false /p:NuGetRestorePackages=false /p:Version='{version}' -v:m"); } );