Build Files

This commit is contained in:
Brett Hewitson 2021-08-20 11:54:24 +10:00
parent 671096a758
commit 3cf9accefc
11 changed files with 599 additions and 3 deletions

View file

@ -0,0 +1,2 @@
powershell -ExecutionPolicy Bypass -File MakeLatestBetaVersionGithub.ps1
PAUSE

View file

@ -0,0 +1,2 @@
powershell -ExecutionPolicy Bypass -File MakeLatestVersionGithub.ps1
PAUSE

View file

@ -0,0 +1,54 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define rootPath "D:\GitHub\ServerManagers\src\ConanServerManager"
#include "D:\GitHub\ServerManagers\src\ConanServerManager\Installer.txt"
[Setup]
; NOTD: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{783D6AFF-E78C-44D5-B9E2-764D7C62C7FD}
AppName=Conan Server Manager
AppVersion={#AppVer}
AppPublisher=Open Source Server Managers
AppPublisherURL=http://servermanagers.freeforums.net
AppSupportURL=http://servermanagers.freeforums.net/board/39/tech-support-bug-reports
AppUpdatesURL=http://servermanagers.freeforums.net/thread/36/downloads
DefaultDirName={pf}\ConanServerManager
DisableProgramGroupPage=yes
SetupIconFile={#rootPath}\Art\favicon.ico
VersionInfoVersion={#AppVerFull}
ArchitecturesAllowed=x86 x64 ia64
ArchitecturesInstallIn64BitMode=x64 ia64
Compression=lzma
SolidCompression=yes
UninstallDisplayName=Conan Server Manager
UninstallDisplayIcon={app}\ConanServerManager.exe
SourceDir={#rootPath}\publish\Application Files\ConanServerManager_{#AppVerPath}
OutputDir={#rootPath}\publish\
OutputBaseFilename=ConanServerManager_{#AppVer}
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
Source: "ConanServerManager.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{commonprograms}\ConanServerManager"; Filename: "{app}\ConanServerManager.exe"; Comment: "Start Conan Server Manager"
Name: "{commondesktop}\ConanServerManager"; Filename: "{app}\ConanServerManager.exe"; Comment: "Start Conan Server Manager"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\ConanServerManager"; Filename: "{app}\ConanServerManager.exe"; Comment: "Start Conan Server Manager"; Tasks: quicklaunchicon
[Run]
Filename: "{app}\ConanServerManager.exe"; Description: "{cm:LaunchProgram,Conan Server Manager}"; Flags: nowait postinstall skipifsilent unchecked

View file

@ -0,0 +1,103 @@
Param
(
[Parameter()]
[string]$rootPath = "D:\GitHub\ServerManagers\src\ConanServerManager",
[Parameter()]
[string]$publishDir = "publish",
[Parameter()]
[string]$srcXmlFilename = "ConanServerManager.application",
[Parameter()]
[string]$destLatestFilename = "latestbeta.txt",
[Parameter()]
[string]$filenamePrefix = "ConanServerManager_",
[Parameter()]
[string]$feedFilename = "VersionFeedBeta.xml",
[Parameter()]
[string]$signTool = "C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool\SignTool.exe",
[Parameter()]
[string]$signNFlag = "${env:SIGN_NFLAG}",
[Parameter()]
[string]$signTFlag = "http://timestamp.digicert.com",
[Parameter()]
[string]$githubRoot = "D:\GitHub\ServerManagers\CSM\beta"
)
[string] $AppVersion = ""
[string] $AppVersionShort = ""
function Get-LatestVersion()
{
$xmlFile = "$($rootPath)\$($publishDir)\$($srcXmlFilename)"
$xml = [xml](Get-Content $xmlFile)
$version = $xml.assembly.assemblyIdentity | Select version
return $version.version;
}
function Sign-Application ( $sourcedir , $signFile )
{
if(Test-Path $signTool)
{
if(($signFile -ne "") -and ($signNFlag -ne "") -and ($signTFlag -ne ""))
{
Write-Host "Signing $($signFile)"
& $signTool sign /n "$($signNFlag)" /t $signTFlag "$($sourcedir)\$($signFile)"
}
}
}
function Create-Zip( $sourcePath , $zipFile )
{
if(Test-Path $zipFile)
{
Remove-Item -LiteralPath:$zipFile -Force
}
Add-Type -Assembly System.IO.Compression.FileSystem
Write-Host "Zipping $($sourcePath) into $($zipFile)"
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourcePath, $zipFile, $compressionLevel, $false)
}
$publishPath = "$($rootPath)\$($publishDir)"
$txtDestFile = "$($publishPath)\$($destLatestFilename)"
$feedFile = "$($rootPath)\$($feedFilename)"
$languageFile = "$($rootPath)\Globalization\en-US\en-US.xaml"
$filenamePrefixStripped = $filenamePrefix.Replace(' ', '')
$AppVersion = Get-LatestVersion
$AppVersionShort = $AppVersion
$AppVersionShort | Set-Content "$($txtDestFile)"
Write-Host "LatestVersion $($AppVersionShort) ($($AppVersion))"
$versionWithUnderscores = $AppVersion.Replace('.', '_')
$publishSrcDir = "$($publishPath)\Application Files\$($filenamePrefix)$($versionWithUnderscores)"
Remove-Item -Path "$($publishSrcDir)\$($srcXmlFilename)" -ErrorAction Ignore
#copy the server manager updater (exe) and prefix with 'New'
Write-Host "Copying the server manager updater (exe) and prefix with 'New'"
Copy-Item -Path "$($publishSrcDir)\ServerManagerUpdater.exe" -Destination "$($publishSrcDir)\NewServerManagerUpdater.exe"
#sign the executable files
Sign-Application $publishSrcDir "*.exe"
$zipDestFileName = "$($filenamePrefixStripped)$($AppVersionShort).zip"
$zipDestFile = "$($publishPath)\$($zipDestFileName)"
Create-Zip $publishSrcDir $zipDestFile
#delete the copied server manager updater File
Remove-Item -Path "$($publishSrcDir)\NewServerManagerUpdater.exe" -ErrorAction Ignore
# copy the files to the GITHUB folder
Write-Host "Copying files to the github folder"
Copy-Item -Path "$feedFile" -Destination "$githubRoot\VersionFeed.xml"
Copy-Item -Path "$languageFile" -Destination $githubRoot
Copy-Item -Path "$txtDestFile" -Destination "$githubRoot\latest.txt"
Copy-Item -Path "$zipDestFile" -Destination "$githubRoot\latest.zip"

View file

@ -0,0 +1,137 @@
Param
(
[Parameter()]
[string]$rootPath = "D:\GitHub\ServerManagers\src\ConanServerManager",
[Parameter()]
[string]$publishDir = "publish",
[Parameter()]
[string]$srcXmlFilename = "ConanServerManager.application",
[Parameter()]
[string]$destLatestFilename = "latest.txt",
[Parameter()]
[string]$filenamePrefix = "ConanServerManager_",
[Parameter()]
[string]$feedFilename = "VersionFeed.xml",
[Parameter()]
[string]$signTool = "C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool\SignTool.exe",
[Parameter()]
[string]$signNFlag = "${env:SIGN_NFLAG}",
[Parameter()]
[string]$signTFlag = "http://timestamp.digicert.com",
[Parameter()]
[string]$installerTool = "C:\Program Files (x86)\Inno Setup 5\ISCC.exe",
[Parameter()]
[string]$githubRoot = "D:\GitHub\ServerManagers\CSM"
)
[string] $AppVersion = ""
[string] $AppVersionShort = ""
function Get-LatestVersion()
{
$xmlFile = "$($rootPath)\$($publishDir)\$($srcXmlFilename)"
$xml = [xml](Get-Content $xmlFile)
$version = $xml.assembly.assemblyIdentity | Select version
return $version.version;
}
function Sign-Application ( $sourcedir , $signFile )
{
if(Test-Path $signTool)
{
if(($signFile -ne "") -and ($signNFlag -ne "") -and ($signTFlag -ne ""))
{
Write-Host "Signing $($signFile)"
& $signTool sign /n "$($signNFlag)" /t $signTFlag "$($sourcedir)\$($signFile)"
}
}
}
function Create-Zip( $sourcePath , $zipFile )
{
if(Test-Path $zipFile)
{
Remove-Item -LiteralPath:$zipFile -Force
}
Add-Type -Assembly System.IO.Compression.FileSystem
Write-Host "Zipping $($sourcePath) into $($zipFile)"
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourcePath, $zipFile, $compressionLevel, $false)
}
function Create-Installer()
{
if(Test-Path $installerTool)
{
if(($installScriptFile -ne "") -and ($installTextFile -ne ""))
{
$installTextFileContent = @"
#define AppVer "$($AppVersionShort)"
#define AppVerFull "$($AppVersion)"
#define AppVerPath "$($versionWithUnderscores)"
"@
$installTextFileContent | Out-File -LiteralPath:$installTextFile -Force -Encoding ascii
Write-Host "Creating installer $($installerFile)"
& "$installerTool" "$installScriptFile"
}
}
}
$publishPath = "$($rootPath)\$($publishDir)"
$txtDestFile = "$($publishPath)\$($destLatestFilename)"
$feedFile = "$($rootPath)\$($feedFilename)"
$languageFile = "$($rootPath)\Globalization\en-US\en-US.xaml"
$installTextFile = "$($rootPath)\Installer.txt"
$installScriptFile = "$($rootPath)\Installer.iss"
$filenamePrefixStripped = $filenamePrefix.Replace(' ', '')
$AppVersion = Get-LatestVersion
$AppVersionShort = $AppVersion.Substring(0, $AppVersion.LastIndexOf('.'))
$AppVersionShort | Set-Content "$($txtDestFile)"
Write-Host "LatestVersion $($AppVersionShort) ($($AppVersion))"
$versionWithUnderscores = $AppVersion.Replace('.', '_')
$publishSrcDir = "$($publishPath)\Application Files\$($filenamePrefix)$($versionWithUnderscores)"
Remove-Item -Path "$($publishSrcDir)\$($srcXmlFilename)" -ErrorAction Ignore
#copy the server manager updater (exe) and prefix with 'New'
Write-Host "Copying the server manager updater (exe) and prefix with 'New'"
Copy-Item -Path "$($publishSrcDir)\ServerManagerUpdater.exe" -Destination "$($publishSrcDir)\NewServerManagerUpdater.exe"
#sign the executable files
Sign-Application $publishSrcDir "*.exe"
$zipDestFileName = "$($filenamePrefixStripped)$($AppVersionShort).zip"
$zipDestFile = "$($publishPath)\$($zipDestFileName)"
Create-Zip $publishSrcDir $zipDestFile
#delete the copied server manager updater File - do not want to include in the installer
Remove-Item -Path "$($publishSrcDir)\NewServerManagerUpdater.exe" -ErrorAction Ignore
$installerFileName = "$($filenamePrefixStripped)$($AppVersionShort).exe"
$installerFile = "$($publishPath)\$($installerFileName)"
Create-Installer
#sign the installer file
Sign-Application $publishPath $installerFileName
# copy the files to the GITHUB folder
Write-Host "Copying files to the github folder"
Copy-Item -Path "$feedFile" -Destination "$githubRoot\VersionFeed.xml"
Copy-Item -Path "$languageFile" -Destination $githubRoot
Copy-Item -Path "$txtDestFile" -Destination "$githubRoot\latest.txt"
Copy-Item -Path "$zipDestFile" -Destination $githubRoot
Copy-Item -Path "$installerFile" -Destination $githubRoot
Copy-Item -Path "$zipDestFile" -Destination "$githubRoot\latest.zip"
Copy-Item -Path "$installerFile" -Destination "$githubRoot\latest.exe"