Skip to content

Instantly share code, notes, and snippets.

@giacomelli
Last active May 31, 2019 00:29
Show Gist options
  • Save giacomelli/1d47b7bf7e9a2b3806dbd0b0332743d2 to your computer and use it in GitHub Desktop.
Save giacomelli/1d47b7bf7e9a2b3806dbd0b0332743d2 to your computer and use it in GitHub Desktop.
trigger:
- master
- develop
- release/*
pool:
vmImage: 'windows-latest'
variables:
azureSubscription: '<AZURE SUBSCRIPTION>'
buildPlatform: 'Any CPU'
buildConfiguration: '<Debug|Release|...>'
solution: '<PATH TO SOLUTION FILE (.sln)>'
webJobsProjectName: '<WEBJOBS PROJECT NAME>'
webJobsName: '<WEBJOBS NAME (AS DEFINED ON AZURE WEB INTERFACE)>'
webAppName: '<WEB APP NAME ON AZURE>'
ftpServerUrl: 'ftp://<AZURE FTP URL>'
ftpUsername: '<AZURE FTP USERNAME>'
ftpPassword: '<AZURE FTP PASSWORD>'
steps:
- task: NuGetToolInstaller@0
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
displayName: 'Build'
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: AzureAppServiceManage@0
displayName: 'WebJob: stop'
inputs:
azureSubscription: $(azureSubscription)
Action: 'Stop all continuous webjobs'
WebAppName: $(webAppName)
- task: FtpUpload@2
displayName: 'WebJob: publish'
inputs:
credentialsOption: 'inputs'
serverUrl: $(ftpServerUrl)
username: $(ftpUsername)
password: $(ftpPassword)
rootDirectory: '$(build.SourcesDirectory)/src/$(webJobsProjectName)/bin/$(buildConfiguration)/'
filePatterns: '**'
remoteDirectory: '/site/jobs/continuous/$(webJobsName)/'
clean: false
cleanContents: false
preservePaths: true
trustSSL: false
- task: AzureAppServiceManage@0
displayName: 'WebJob: start'
inputs:
azureSubscription: $(azureSubscription)
Action: 'Start all continuous webjobs'
WebAppName: $(webAppName)
var physicalPath: string = '/site/wwwroot';
if(taskParams.VirtualApplication)
{
physicalPath = await appServiceUtility.getPhysicalPath(taskParams.VirtualApplication);
await kuduServiceUtility.createPathIfRequired(physicalPath);
virtualApplicationPath = physicalPath;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment