Skip to content

Commit 3c65262

Browse files
committed
Fixes to publish script
1 parent a072a89 commit 3c65262

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

Scripts/Publish.ps1

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@ $PublishDir = "$Root/Publish"
44
$ArtifactsDir = "$Root/Publish/Artifacts"
55
$Color = "Blue"
66

7+
# Prerequsites
8+
Write-Host -ForegroundColor $Color "Installing prerequisites"
9+
dotnet tool install --global minver-cli
10+
711
Write-Host -ForegroundColor $Color "Clean up from previous publishes"
812
Remove-Item -Path $PublishDir/* -Recurse -Force -ErrorAction Ignore | Out-Null
913

14+
$version = minver;
15+
Write-Host -ForegroundColor Cyan "Version: $version"
16+
17+
# Override version so minver does not calculate it per package
18+
$env:MinVerVersionOverride = $version
19+
1020
Write-Host -ForegroundColor $Color "Publish the dll files"
1121
$PwshFramework = "netstandard2.0" # Version needed by PowerShell
1222
dotnet publish $Root/Src/FastData/FastData.csproj -c $Config -f $PwshFramework -p:GenerateDependencyFile=false -o $ArtifactsDir
@@ -15,12 +25,6 @@ dotnet publish $Root/Src/FastData.Generator.CSharp/FastData.Generator.CSharp.csp
1525
dotnet publish $Root/Src/FastData.Generator.CPlusPlus/FastData.Generator.CPlusPlus.csproj -c $Config -f $PwshFramework -p:GenerateDependencyFile=false -o $ArtifactsDir
1626
dotnet publish $Root/Src/FastData.Generator.Rust/FastData.Generator.Rust.csproj -c $Config -f $PwshFramework -p:GenerateDependencyFile=false -o $ArtifactsDir
1727

18-
Write-Host -ForegroundColor $Color "Get the version number of the generator dll file"
19-
$ver = [System.Reflection.AssemblyName]::GetAssemblyName("$ArtifactsDir/Genbox.FastData.dll").Version
20-
$semver = "$($ver.Major).$($ver.Minor).$($ver.Build)"
21-
22-
Write-Host -ForegroundColor Cyan "Version: $semver"
23-
2428
Write-Host -ForegroundColor $Color "Pack the CLI tool as executable"
2529
dotnet publish $Root/Src/FastData.Cli/FastData.Cli.csproj -c $Config -r win-x64 -p:PublishSingleFile=true -p:SelfContained=true -p:PublishTrimmed=true -p:TargetFrameworks="net9.0" -p:DebugType=none -p:GenerateDocumentationFile=false -p:EnableCompressionInSingleFile=true -p:InvariantGlobalization=true -o $PublishDir
2630
Move-Item $PublishDir/Genbox.FastData.Cli.exe $PublishDir/FastData-win.exe -Force
@@ -56,7 +60,7 @@ Copy-Item $Root/Misc/PowerShell/FastData.psm1 $PublishDir/Genbox.FastData/Genbox
5660
Copy-Item $ArtifactsDir/*.dll $PublishDir/Genbox.FastData/lib/
5761

5862
# We don't want to publish versions with tags like "alpha", "beta", etc.
59-
if ($ver -like "*-*") {
63+
if ($version -notlike "*-*") {
6064
if ($env:PWSHG_KEY) {
6165
Write-Host -ForegroundColor $Color "Publish PowerShell to PowerShell Gallery"
6266
Publish-Module -Path "$PublishDir/Genbox.FastData/" -NuGetApiKey $env:PWSHG_KEY
@@ -65,7 +69,7 @@ if ($ver -like "*-*") {
6569
Write-Host -ForegroundColor Yellow "Skipping PowerShell publish: PWSHG_KEY not set."
6670
}
6771

68-
if ($env:NUGET_KEY -and ($ver -notlike "*alpha*")) {
72+
if ($env:NUGET_KEY) {
6973
Write-Host -ForegroundColor $Color "Publish dotnet tool to NuGet"
7074
Get-ChildItem -Path "$PublishDir/*.nupkg" | ForEach-Object {
7175
dotnet nuget push --skip-duplicate $_.FullName --api-key $env:NUGET_KEY --source https://api.nuget.org/v3/index.json
@@ -74,4 +78,7 @@ if ($ver -like "*-*") {
7478
else {
7579
Write-Host -ForegroundColor Yellow "Skipping NuGet push: NUGET_KEY not set."
7680
}
81+
}
82+
else {
83+
Write-Host -ForegroundColor Yellow "Skipping publish due to alpha build"
7784
}

0 commit comments

Comments
 (0)