-
-
Save jrgcubano/59e18a9d98c127f9725338c10028ee91 to your computer and use it in GitHub Desktop.
An example Octopus deployment script for WPF ClickOnce applications.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write-Host 'Copy the package payload over to the clickonce web application location' | |
$source = ".\" | |
$dest = "C:\Octopus\Applications\${OctopusEnvironmentName}\NextGen.ClickOnce\${OctopusPackageVersion}\Package" | |
$exclude = @('*.pdb','mage.exe', '*.ps1', '*Build*', '*.pfx') | |
$appManifestName = "${OctopusPackageName}.exe.manifest" | |
$appManifestPath = Join-Path $dest $appManifestName | |
$deployManifestPath = Join-Path $dest "${OctopusPackageName}.application" | |
Write-Host 'Create package folder and copy everything' | |
New-Item -ItemType directory -Path $dest | |
Get-ChildItem $source -Recurse -Exclude $exclude | Copy-Item -Destination $dest | |
Write-Host 'Create app manifest' | |
& ".\Build\Mage.exe" -New Application -Name "${OctopusPackageName} ${OctopusEnvironmentName}" -ToFile $appManifestPath -FromDirectory $dest -Version $OctopusPackageVersion | Write-Host | |
#& ".\Build\Mage.exe" -Sign $appManifestPath -CertFile .\ClickOnce.pfx -Password password | |
Write-Host 'Create deploy manifest' | |
& ".\Build\Mage.exe" -New Deployment -AppManifest $appManifestPath -Install true -Publisher "Andrew Best" -ProviderUrl "http://ci/AppName.${OctopusEnvironmentName}/Package/${OctopusPackageName}.application" -Version $OctopusPackageVersion -Name "${OctopusPackageName} ${OctopusEnvironmentName}" -ToFile $deployManifestPath | Write-Host | |
Write-Host 'Add deploy extension to files' | |
$ex = @('*.application', '*.manifest') | |
$packageFiles = Get-ChildItem $dest -Recurse -Exclude $ex | |
foreach ($file in $packageFiles) { | |
$newname = $file.name + ".deploy" | |
Rename-Item -Path $file -NewName $newname | |
} | |
Write-Host 'Add mapFileExtensions to deploy manifest so that it works with the *.deploy extension' | |
$xml = [xml](Get-Content "$deployManifestPath") | |
$deployment_node = $xml.SelectSingleNode("//*[local-name() = 'deployment']") | |
$deployment_node.SetAttribute("mapFileExtensions", "true") | |
$xml.Save("$deployManifestPath") | |
#Write-Host 'Sign deploy manifest' | |
#& ".\Build\Mage.exe" -Sign $deployManifestPath -CertFile .\ClickOnceSpike_TemporaryKey.pfx -Password centium | |
#Run Database with the configured connection string to migrate our testDb | |
#$connectionString = $OctopusParameters["DbContext"] | |
#$zeroDb = $OctopusParameters["ZeroDb"] | |
#& "bin\Database.exe" $connectionString $zeroDb | Write-Host |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment