| 1 |
# Configure the details of the functionapp |
| 2 |
variables: |
| 3 |
azureSubscription: '{ARM ACCESS TOKEN NAME}' |
| 4 |
storageName: '{STORAGE NAME OF FUNCTIONAPP}' |
| 5 |
functionappName: '{NAME OF FUNCTIONAPP}' |
| 6 |
resourceGroupName: '{RESOURCE GROUP NAME OF FUNCTIONAPP}' |
| 7 |
|
| 8 |
jobs: |
| 9 |
# Build the python packages in a virtual env |
| 10 |
- job: Build |
| 11 |
pool: |
| 12 |
vmImage: ubuntu-16.04 |
| 13 |
steps: |
| 14 |
- script: | |
| 15 |
dotnet restore # COMMENT OUT IF NOT USING FUNCTION EXTENSIONS |
| 16 |
dotnet build --runtime ubuntu.16.04-x64 --output './bin/' # COMMENT OUT IF NOT USING FUNCTION EXTENSIONS |
| 17 |
npm install |
| 18 |
npm run build --if-present |
| 19 |
npm prune --production |
| 20 |
- task: ArchiveFiles@2 |
| 21 |
displayName: "Archive files" |
| 22 |
inputs: |
| 23 |
rootFolderOrFile: "$(System.DefaultWorkingDirectory)" |
| 24 |
includeRootFolder: false |
| 25 |
archiveFile: "$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip" |
| 26 |
- task: PublishBuildArtifacts@1 |
| 27 |
inputs: |
| 28 |
PathtoPublish: '$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip' |
| 29 |
name: 'drop' |
| 30 |
# Download the build artifacts from |
| 31 |
- job: Deploy |
| 32 |
pool: |
| 33 |
vmImage: 'VS2017-Win2016' |
| 34 |
steps: |
| 35 |
- task: DownloadBuildArtifacts@0 |
| 36 |
inputs: |
| 37 |
buildType: 'current' |
| 38 |
downloadType: 'single' |
| 39 |
artifactName: 'drop' |
| 40 |
downloadPath: '$(System.DefaultWorkingDirectory)' |
| 41 |
- task: AzureFileCopy@2 |
| 42 |
inputs: |
| 43 |
sourcePath: "drop/build$(Build.BuildId).zip" |
| 44 |
azureConnectionType: 'ConnectedServiceNameARM' |
| 45 |
azureSubscription: "$(azureSubscription)" |
| 46 |
destination: azureBlob |
| 47 |
storage: "$(storageName)" |
| 48 |
containerName: 'azure-build' |
| 49 |
- task: createsastoken@1 |
| 50 |
inputs: |
| 51 |
ConnectedServiceName: "$(azureSubscription)" |
| 52 |
StorageAccountRM: "$(storageName)" |
| 53 |
SasTokenTimeOutInHours: 10000 |
| 54 |
Permission: 'r' |
| 55 |
StorageContainerName: 'azure-build' |
| 56 |
- task: AzureAppServiceSetAppSettings@2 |
| 57 |
inputs: |
| 58 |
ConnectedServiceName: "$(azureSubscription)" |
| 59 |
WebAppName: "$(functionappName)" |
| 60 |
ResourceGroupName: "$(resourceGroupName)" |
| 61 |
AppSettings: "WEBSITE_RUN_FROM_PACKAGE='$(storageUri)/build$(Build.BuildId).zip$(storageToken)'" |
| 62 |
|
| 63 |
dependsOn: Build |
| 64 |
condition: succeeded() |