Merge pull request #5 from solita/feature123 #3
This file contains 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
name: Function app build | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
variables: | ||
azureSubscription: ${{ secrets.ARM_SUBSCRIPTION_ID }} | ||
# Function app name | ||
functionAppName: 'clamav' | ||
# Agent VM image name | ||
vmImageName: 'ubuntu-latest' | ||
# Working Directory | ||
workingDirectory: ./function/ | ||
stages: | ||
- stage: Build | ||
displayName: Build stage | ||
jobs: | ||
- job: Build | ||
displayName: Build | ||
runs-on: '$(vmImageName)' | ||
- task: UsePythonVersion@0 | ||
displayName: 'Use Python 3.10' | ||
inputs: | ||
versionSpec: 3.11 | ||
- bash: | | ||
pip install --target="./.python_packages/lib/site-packages" -r ./requirements.txt | ||
workingDirectory: $(workingDirectory) | ||
displayName: 'Install application dependencies' | ||
- task: ArchiveFiles@2 | ||
displayName: 'Archive files' | ||
inputs: | ||
rootFolderOrFile: '$(workingDirectory)' | ||
includeRootFolder: false | ||
archiveType: zip | ||
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip | ||
replaceExistingArchive: true | ||
- publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip | ||
artifact: drop | ||
- stage: Deploy | ||
displayName: Deploy stage | ||
dependsOn: Build | ||
condition: succeeded() | ||
jobs: | ||
- deployment: Deploy | ||
displayName: Deploy | ||
environment: 'development' | ||
runs-on: $(vmImageName) | ||
strategy: | ||
runOnce: | ||
deploy: | ||
steps: | ||
- task: AzureFunctionApp@1 | ||
displayName: 'Azure functions app deploy' | ||
inputs: | ||
azureSubscription: '$(azureSubscription)' | ||
appType: functionAppLinux | ||
appName: $(functionAppName) | ||
package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip' |