Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ryhanen/75c542ff84fbf46f49ef to your computer and use it in GitHub Desktop.

Select an option

Save ryhanen/75c542ff84fbf46f49ef to your computer and use it in GitHub Desktop.
param (
[string]$env = "",
[switch]$latest = $false
)
#####################################################################
######################## SET DEPL PARAMETERS ########################
#####################################################################
$integrationname = "Friendly name for your integration here. Shows in UI"
$integrationfolder = "Folder name of the components related to this integration"
$application = "BTS Application name for this integration"
$destinationRoot="c:\ProgramFiles (x86)\Integrations\"
######################################################################
######################## CONFIG DEPL SETTINGS ########################
######################## DO NOT CHANGE! ########################
######################################################################
#
# Add reference to common functions and paths
#
. "location_of_the_helper_functions\powershell_helpers_for_biztalk_deployments.ps1"
#
# Print info of the integration to be deployed
#
printInfo -integrationname $integrationName
#
# Automatic deployment of the latest version
# - Requires command line parameters -latest and -env
#
if ($latest -and $env -ne "")
{
#
# Get version from the latest_versions
# - sets version variable
#
$version = getLatestVersion
}
#
# Manual deployment
#
else
{
#
# Ask for deployment settings
# - sets env and version variables
#
$settings = askSettings -integrationname $integrationname
$env = $settings[0]
$version = $settings[1]
}
#
# Get environment parameters
#
$environmentSettings = getEnvironmentSettings($env)
$database = $environmentSettings[0]
$server = $environmentSettings[1]
####################################################################
######################## SET ENV PARAMETERS ########################
####################################################################
# Set any parameters that are environment specific and valid only for this integration
#DEV
If ($env -eq "DEV") {
$bindings = "$deploymentpath\$integrationfolder\$version\Bindings\foobar.PortBindings.dev.xml"
}
#TEST
If ($env -eq "TEST") {
$bindings = "$deploymentpath\$integrationfolder\$version\Bindings\foobar.PortBindings.test.xml"
}
#STAGE
If ($env -eq "STAGE") {
$bindings = "$deploymentpath\$integrationfolder\$version\Bindings\foobar.PortBindings.stage.xml"
}
#PROD
If ($env -eq "PROD") {
$bindings = "$deploymentpath\$integrationfolder\$version\Bindings\foobar.PortBindings.prod.xml"
}
##############################################################################
######################## CONFIGURE DEPLOYMENT PROCESS ########################
##############################################################################
#
# Terminate service instances
#
$ok = terminateInstances -assemblyName "assembly_name_here" -assemblyKey "XXX"
#
# Unenlist orchestrations
#
if ($ok) {$ok = unenlistOrchestration -orch "orch_name_here" -assembly "assembly_name_here"}
#
# Remove assemblies
#
if ($ok) {$ok = removeAssembly -server $server -database $database -application $application -assembly "assembly_name_here, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=XXX"}
#
# Deploy assemblies
#
if ($ok) {$ok = deployAssembly -server $server -database $database -application $application -source $deploymentpath\$integrationfolder\$version\assembly_name_here.dll -destination $destinationRoot\$integrationfolder\$version\assembly_name_here.dll}
#
# Import bindings
#
if ($ok) {$ok = importBindings -application $application -bindings $bindings}
#
# You can customize the process any way you need and add more steps. This is just a simple example.
#
#
# Print result
#
if ($ok) {printOK}
else {printNOK}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment