Skip to content

Commit

Permalink
Add pre-release versioning support
Browse files Browse the repository at this point in the history
  • Loading branch information
Smalls1652 committed Mar 17, 2024
1 parent e8476fd commit 24bad5d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Pwsh/Pwsh.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<Copy SourceFiles="$(TemplateModuleManifestPath)" DestinationFolder="$(MSBuildProjectDirectory)" />
</Target>
<Target Name="UpdateModuleManifest" BeforeTargets="Build">
<Exec Command="pwsh -NoProfile -File 'Update-PwshModuleManifestVersion.ps1' -Version '$(AssemblyVersion)'" />
<Exec Command="pwsh -NoProfile -File 'Update-PwshModuleManifestVersion.ps1' -Version '$(VersionPrefix)' -PrereleaseVersion '$(VersionSuffix)'" />
</Target>
<Target Name="CreatePowerShellModule" AfterTargets="Publish">
<PropertyGroup>
Expand Down
8 changes: 7 additions & 1 deletion src/Pwsh/Update-PwshModuleManifestVersion.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[CmdletBinding()]
param(
[Parameter(Position = 0)]
[string]$Version
[string]$Version,
[Parameter(Position = 1)]
[string]$PrereleaseVersion
)

$outputManifestPath = Join-Path -Path $PSScriptRoot -ChildPath "SmallsOnline.Subnetting.Pwsh.psd1"
Expand All @@ -10,4 +12,8 @@ $manifest = Get-Content -Path $outputManifestPath -Raw

$manifest = $manifest.Replace("{{ VERSION }}", $Version)

if ($null -ne $PrereleaseVersion -and [string]::IsNullOrEmpty($PrereleaseVersion) -eq $false) {
$manifest = $manifest.Replace("{{ PRERELEASE_VERSION }}", $PrereleaseVersion)
}

$manifest | Set-Content -Path $outputManifestPath -Force
2 changes: 1 addition & 1 deletion src/TemplateFiles/SmallsOnline.Subnetting.Pwsh.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
# ReleaseNotes = ""

# Prerelease string of this module
# Prerelease = ""
Prerelease = "{{ PRERELEASE_VERSION }}"

# Flag to indicate whether the module requires explicit user acceptance for install/update/save
RequireLicenseAcceptance = $false
Expand Down

0 comments on commit 24bad5d

Please sign in to comment.