mirror of
https://github.com/microsoft/PowerToys
synced 2025-08-22 01:58:04 +00:00
This pull request adopts the unified versioning scheme used by Windows Terminal, Notepad, and hundreds of other internal and public projects that relied on "XES" or "PackageES". It only does so for the command palette. All command palette assets will be versioned according to the Major and Minor number in `src/modules/cmdpal/custom.props`. This includes DLLs, EXEs, NuGet packages and MSIX bundles. This will ensure that all artifacts that we produce are versioned properly: | thing | version (ex.) | |---------|-----------------| | dll/exe | 0.2.2505.08001 | | nupkg | 0.2.250508001 | | appx | 0.2.3269.0 | For reference, here's the version format: ### EXE, DLL, .NET Assembly 0.2.2505.08001 ^ ^ ^ ^ ^ ^ | | | | | `-Build # on that date | | | | `-Day | | | `-Month | | `-Year | `-Minor `-Major ### NuGet Package 0.2.250508001 ^ ^ ^ ^ ^ ^ | | | | | `-Build # on that date | | | | `-Day | | | `-Month | | `-Year | `-Minor `-Major ### AppX Package 0.2.01281.0 (the leading 0 will be removed) ^ ^ ^ ^^ ^ | | | || `-Contractually always zero (a waste) | | | |`-Build # on that date | | | `-Number of days in [base year] | | `-Number of years since [base year] | `-Minor `-Major [base year] = $(XesBaseYearForStoreVersion) It is expected that the base year is changed every time the version number is changed.
89 lines
4.5 KiB
PowerShell
89 lines
4.5 KiB
PowerShell
[CmdletBinding()]
|
|
Param(
|
|
[Parameter(Mandatory=$True,Position=1)]
|
|
[string]$versionNumber = "0.0.1",
|
|
|
|
[Parameter(Mandatory=$True,Position=2)]
|
|
[AllowEmptyString()]
|
|
[string]$DevEnvironment = "Local"
|
|
)
|
|
|
|
Write-Host $PSScriptRoot
|
|
$versionRegex = "(\d+)\.(\d+)\.(\d+)"
|
|
|
|
if($versionNumber -match $versionRegEx)
|
|
{
|
|
#$buildDayOfYear = (Get-Date).DayofYear;
|
|
#$buildTime = Get-Date -Format HH;
|
|
#$buildTime = Get-Date -Format HHmmss;
|
|
#$buildYear = Get-Date -Format yy;
|
|
#$revision = [string]::Format("{0}{1}{2}", $buildYear, $buildDayOfYear, $buildTime )
|
|
|
|
# max UInt16, 65535
|
|
#$revision = [string]::Format("{0}{1}", $buildDayOfYear, $buildTime )
|
|
#Write-Host "Revision" $revision
|
|
|
|
$versionNumber = [int]::Parse($matches[1]).ToString() + "." + [int]::Parse($matches[2]).ToString() + "." + [int]::Parse($matches[3]).ToString() # + "." + $revision
|
|
Write-Host "Version Number" $versionNumber
|
|
}
|
|
else
|
|
{
|
|
throw "Build format does not match the expected pattern (buildName_w.x.y.z)"
|
|
}
|
|
|
|
$verPropWriteFileLocation = $PSScriptRoot + '/../src/Version.props';
|
|
$verPropReadFileLocation = $verPropWriteFileLocation;
|
|
|
|
[XML]$verProps = Get-Content $verPropReadFileLocation
|
|
$verProps.Project.PropertyGroup.Version = $versionNumber;
|
|
$verProps.Project.PropertyGroup.DevEnvironment = $DevEnvironment;
|
|
|
|
Write-Host "xml" $verProps.Project.PropertyGroup.Version
|
|
$verProps.Save($verPropWriteFileLocation);
|
|
|
|
|
|
#### The same thing as above, but for the CmdPal version
|
|
$verPropWriteFileLocation = $PSScriptRoot + '/../src/CmdPalVersion.props';
|
|
$verPropReadFileLocation = $verPropWriteFileLocation;
|
|
[XML]$verProps = Get-Content $verPropReadFileLocation
|
|
$verProps.Project.PropertyGroup.DevEnvironment = $DevEnvironment;
|
|
Write-Host "xml" $verProps.Project.PropertyGroup.Version
|
|
$verProps.Save($verPropWriteFileLocation);
|
|
#######
|
|
|
|
# Set PowerRenameContextMenu package version in AppManifest.xml
|
|
$powerRenameContextMenuAppManifestWriteFileLocation = $PSScriptRoot + '/../src/modules/powerrename/PowerRenameContextMenu/AppxManifest.xml';
|
|
$powerRenameContextMenuAppManifestReadFileLocation = $powerRenameContextMenuAppManifestWriteFileLocation;
|
|
|
|
[XML]$powerRenameContextMenuAppManifest = Get-Content $powerRenameContextMenuAppManifestReadFileLocation
|
|
$powerRenameContextMenuAppManifest.Package.Identity.Version = $versionNumber + '.0'
|
|
Write-Host "PowerRenameContextMenu version" $powerRenameContextMenuAppManifest.Package.Identity.Version
|
|
$powerRenameContextMenuAppManifest.Save($powerRenameContextMenuAppManifestWriteFileLocation);
|
|
|
|
# Set ImageResizerContextMenu package version in AppManifest.xml
|
|
$imageResizerContextMenuAppManifestWriteFileLocation = $PSScriptRoot + '/../src/modules/imageresizer/ImageResizerContextMenu/AppxManifest.xml';
|
|
$imageResizerContextMenuAppManifestReadFileLocation = $imageResizerContextMenuAppManifestWriteFileLocation;
|
|
|
|
[XML]$imageResizerContextMenuAppManifest = Get-Content $imageResizerContextMenuAppManifestReadFileLocation
|
|
$imageResizerContextMenuAppManifest.Package.Identity.Version = $versionNumber + '.0'
|
|
Write-Host "ImageResizerContextMenu version" $imageResizerContextMenuAppManifest.Package.Identity.Version
|
|
$imageResizerContextMenuAppManifest.Save($imageResizerContextMenuAppManifestWriteFileLocation);
|
|
|
|
# Set FileLocksmithContextMenu package version in AppManifest.xml
|
|
$fileLocksmithContextMenuAppManifestWriteFileLocation = $PSScriptRoot + '/../src/modules/FileLocksmith/FileLocksmithContextMenu/AppxManifest.xml';
|
|
$fileLocksmithContextMenuAppManifestReadFileLocation = $fileLocksmithContextMenuAppManifestWriteFileLocation;
|
|
|
|
[XML]$fileLocksmithContextMenuAppManifest = Get-Content $fileLocksmithContextMenuAppManifestReadFileLocation
|
|
$fileLocksmithContextMenuAppManifest.Package.Identity.Version = $versionNumber + '.0'
|
|
Write-Host "FileLocksmithContextMenu version" $fileLocksmithContextMenuAppManifest.Package.Identity.Version
|
|
$fileLocksmithContextMenuAppManifest.Save($fileLocksmithContextMenuAppManifestWriteFileLocation);
|
|
|
|
# Set NewPlusContextMenu package version in AppManifest.xml
|
|
$newPlusContextMenuAppManifestWriteFileLocation = $PSScriptRoot + '/../src/modules/NewPlus/NewShellExtensionContextMenu/AppxManifest.xml';
|
|
$newPlusContextMenuAppManifestReadFileLocation = $newPlusContextMenuAppManifestWriteFileLocation;
|
|
|
|
[XML]$newPlusContextMenuAppManifest = Get-Content $newPlusContextMenuAppManifestReadFileLocation
|
|
$newPlusContextMenuAppManifest.Package.Identity.Version = $versionNumber + '.0'
|
|
Write-Host "NewPlusContextMenu version" $newPlusContextMenuAppManifest.Package.Identity.Version
|
|
$newPlusContextMenuAppManifest.Save($newPlusContextMenuAppManifestWriteFileLocation);
|