Skip to content

Commit 8c54a60

Browse files
committed
Merge branch 'main' of github.com:typinghard/azure-devops-state-tracker-function
2 parents 8c832a7 + 158bfe7 commit 8c54a60

File tree

2 files changed

+152
-0
lines changed

2 files changed

+152
-0
lines changed

azure-pipelines-1.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# .NET Core Function App to Windows on Azure
2+
# Build a .NET Core function app and deploy it to Azure as a Windows function App.
3+
# Add steps that analyze code, save build artifacts, deploy, and more:
4+
# https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core
5+
6+
trigger:
7+
- main
8+
9+
variables:
10+
# Azure Resource Manager connection created during pipeline creation
11+
azureSubscription: 'dbd9bc02-3bce-4286-ad67-7aeff32534bf'
12+
13+
# Function app name
14+
functionAppName: 'func-azure-devops-state-tracker'
15+
16+
# Agent VM image name
17+
vmImageName: 'vs2017-win2016'
18+
19+
# Working Directory
20+
workingDirectory: '$(System.DefaultWorkingDirectory)/AzureDevOpsStateTracker.Functions'
21+
22+
stages:
23+
- stage: Build
24+
displayName: Build stage
25+
26+
jobs:
27+
- job: Build
28+
displayName: Build
29+
pool:
30+
vmImage: $(vmImageName)
31+
32+
steps:
33+
- task: DotNetCoreCLI@2
34+
displayName: Build
35+
inputs:
36+
command: 'build'
37+
projects: |
38+
$(workingDirectory)/*.csproj
39+
arguments: --output $(System.DefaultWorkingDirectory)/publish_output --configuration Release
40+
41+
- task: ArchiveFiles@2
42+
displayName: 'Archive files'
43+
inputs:
44+
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/publish_output'
45+
includeRootFolder: false
46+
archiveType: zip
47+
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
48+
replaceExistingArchive: true
49+
50+
- publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
51+
artifact: drop
52+
53+
- stage: Deploy
54+
displayName: Deploy stage
55+
dependsOn: Build
56+
condition: succeeded()
57+
58+
jobs:
59+
- deployment: Deploy
60+
displayName: Deploy
61+
environment: 'development'
62+
pool:
63+
vmImage: $(vmImageName)
64+
65+
strategy:
66+
runOnce:
67+
deploy:
68+
69+
steps:
70+
- task: AzureFunctionApp@1
71+
displayName: 'Azure functions app deploy'
72+
inputs:
73+
azureSubscription: '$(azureSubscription)'
74+
appType: functionApp
75+
appName: $(functionAppName)
76+
package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'

azure-pipelines.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# .NET Core Function App to Windows on Azure
2+
# Build a .NET Core function app and deploy it to Azure as a Windows function App.
3+
# Add steps that analyze code, save build artifacts, deploy, and more:
4+
# https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core
5+
6+
trigger:
7+
- main
8+
9+
variables:
10+
# Azure Resource Manager connection created during pipeline creation
11+
azureSubscription: '061440c6-b8b2-41ab-98dc-8863642471ff'
12+
13+
# Function app name
14+
functionAppName: 'func-azure-devops-state-tracker'
15+
16+
# Agent VM image name
17+
vmImageName: 'ubuntu-20.04'
18+
19+
# Working Directory
20+
workingDirectory: '$(System.DefaultWorkingDirectory)/AzureDevOpsStateTracker.Functions'
21+
22+
stages:
23+
- stage: Build
24+
displayName: Build stage
25+
26+
jobs:
27+
- job: Build
28+
displayName: Build
29+
pool:
30+
vmImage: $(vmImageName)
31+
32+
steps:
33+
- task: DotNetCoreCLI@2
34+
displayName: Build
35+
inputs:
36+
command: 'build'
37+
projects: |
38+
$(workingDirectory)/*.csproj
39+
arguments: --output $(System.DefaultWorkingDirectory)/publish_output --configuration Release
40+
41+
- task: ArchiveFiles@2
42+
displayName: 'Archive files'
43+
inputs:
44+
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/publish_output'
45+
includeRootFolder: false
46+
archiveType: zip
47+
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
48+
replaceExistingArchive: true
49+
50+
- publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
51+
artifact: drop
52+
53+
- stage: Deploy
54+
displayName: Deploy stage
55+
dependsOn: Build
56+
condition: succeeded()
57+
58+
jobs:
59+
- deployment: Deploy
60+
displayName: Deploy
61+
environment: 'development'
62+
pool:
63+
vmImage: $(vmImageName)
64+
65+
strategy:
66+
runOnce:
67+
deploy:
68+
69+
steps:
70+
- task: AzureFunctionApp@1
71+
displayName: 'Azure functions app deploy'
72+
inputs:
73+
azureSubscription: '$(azureSubscription)'
74+
appType: functionApp
75+
appName: $(functionAppName)
76+
package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'

0 commit comments

Comments
 (0)