Skip to content

Commit

Permalink
add verison CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhathcock committed May 15, 2024
1 parent e246680 commit fa76ce8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
"commands": [
"husky"
]
},
"minver-cli": {
"version": "5.0.0",
"commands": [
"minver"
]
}
}
}
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,6 +37,9 @@ jobs:
- name: Format
run: ./build.ps1 format

- name: Version
run: ./build.ps1 version

- name: Restore
run: ./build.ps1 restore

Expand Down
15 changes: 13 additions & 2 deletions Build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>();
if (args.Length > 1)
Expand Down Expand Up @@ -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,
() =>
Expand All @@ -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");
}
);

Expand Down

0 comments on commit fa76ce8

Please sign in to comment.