-
Notifications
You must be signed in to change notification settings - Fork 0
/
pack.ps1
27 lines (23 loc) · 843 Bytes
/
pack.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$versionFile = "version.txt"
$version = ""
if ( Test-Path $versionFile )
{
$version = Get-Content $versionFile
if ( $version -eq $null -or $version.Split(".").Count -ne 3)
{
Write-Error "Wrong format for version, use X.Y.Z (semver)"
}
}
else
{
Write-Error "Version file does not exist"
}
$splitted = $version.Split(".")
$oldVersion = $newVersion = $splitted[0] + "." + $splitted[1] + "." + ([convert]::ToInt32($version.Split(".")[2],10) - 1)
if ( Test-Path .\sitecore-switch-to-cd.$oldVersion.zip )
{
Remove-Item .\sitecore-switch-to-cd.$oldVersion.zip
}
Compress-Archive -DestinationPath .\sitecore-switch-to-cd.$version.zip -Path .\* -Force
$newVersion = $splitted[0] + "." + $splitted[1] + "." + ([convert]::ToInt32($version.Split(".")[2],10) + 1)
$newVersion | Out-File -FilePath $versionFile