Skip to content

Commit

Permalink
update build script to fetch tag version
Browse files Browse the repository at this point in the history
  • Loading branch information
Kvarkas committed Apr 16, 2024
1 parent baf2cb5 commit 530ffa2
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions PuTTYNG.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ write-host "/===================================================================
write-host "/ This will make a some changes in original putty files to make it compatible with mRemoteNG /"
write-host "/============================================================================================/"
write-host ""
$workFolder = "$PSScriptRoot\putty"

#In case its exists, do delete incase of new version
if (Test-Path -LiteralPath $workFolder) {
Remove-Item -LiteralPath $workFolder -Verbose -Recurse -WhatIf
}

#clone putty into current directory
try {
Expand All @@ -73,12 +79,19 @@ catch {
Write-CustomError -UserMessage 'There was an error' -ErrorObject $_ -FullDetail
}

$workFolder = "$PSScriptRoot\putty"
#Get version of last update
cd putty
$getLastTag = git.exe describe --tags --match="*.*" --abbrev=0 HEAD 2>&1
cd ..

$workFile = "$workFolder\version.h"
$setNewVersion = $getLastTag.split(".")[0] + "," + $getLastTag.split(".")[1] + ",0,0"
write-host "Version: " $setNewVersion

#Change version data
(Get-Content $workFile).Replace('Unidentified build', 'Release 0.80 mRemoteNG') | Set-Content $workFile
(Get-Content $workFile).Replace('Unidentified build', 'Release '+ $getLastTag + ' mRemoteNG') | Set-Content $workFile
(Get-Content $workFile).Replace('-Unidentified-Local-Build', '-Release-mRemoteNG-Build') | Set-Content $workFile
(Get-Content $workFile).Replace('0,0,0,0', '0,80,0,0') | Set-Content $workFile
(Get-Content $workFile).Replace('0,0,0,0', $setNewVersion) | Set-Content $workFile

#Add mRemoteNG required changes
$workFile = "$workFolder\cmdline.c"
Expand Down

0 comments on commit 530ffa2

Please sign in to comment.