Skip to content

Commit 04a5109

Browse files
committed
Set up CI with Azure Pipelines
[skip ci]
1 parent 2ef2822 commit 04a5109

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

azure-pipelines.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Node.js Function App to Linux on Azure
2+
# Build a Node.js function app and deploy it to Azure as a Linux function app.
3+
# Add steps that analyze code, save build artifacts, deploy, and more:
4+
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
5+
6+
trigger:
7+
- master
8+
9+
variables:
10+
11+
# Azure Resource Manager connection created during pipeline creation
12+
azureSubscription: 'cd86fe07-a0e7-445d-a50b-47b75954bb78'
13+
14+
# Function app name
15+
functionAppName: 'time-tracker-azure-functions'
16+
17+
# Environment name
18+
environmentName: 'time-tracker-azure-functions'
19+
20+
# Agent VM image name
21+
vmImageName: 'ubuntu-latest'
22+
23+
stages:
24+
- stage: Build
25+
displayName: Build stage
26+
jobs:
27+
- job: Build
28+
displayName: Build
29+
pool:
30+
vmImage: $(vmImageName)
31+
32+
steps:
33+
- task: NodeTool@0
34+
inputs:
35+
versionSpec: '10.x'
36+
displayName: 'Install Node.js'
37+
38+
- script: |
39+
if [ -f extensions.csproj ]
40+
then
41+
dotnet build extensions.csproj --runtime ubuntu.16.04-x64 --output ./bin
42+
fi
43+
displayName: 'Build extensions'
44+
45+
- script: |
46+
npm install
47+
npm run build --if-present
48+
npm run test --if-present
49+
displayName: 'Prepare binaries'
50+
51+
- task: ArchiveFiles@2
52+
displayName: 'Archive files'
53+
inputs:
54+
rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
55+
includeRootFolder: false
56+
archiveType: zip
57+
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
58+
replaceExistingArchive: true
59+
60+
- upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
61+
artifact: drop
62+
63+
- stage: Deploy
64+
displayName: Deploy stage
65+
dependsOn: Build
66+
condition: succeeded()
67+
jobs:
68+
- deployment: Deploy
69+
displayName: Deploy
70+
environment: $(environmentName)
71+
pool:
72+
vmImage: $(vmImageName)
73+
strategy:
74+
runOnce:
75+
deploy:
76+
steps:
77+
- task: AzureFunctionApp@1
78+
displayName: 'Azure Functions App Deploy: time-tracker-azure-functions'
79+
inputs:
80+
azureSubscription: '$(azureSubscription)'
81+
appType: functionAppLinux
82+
appName: $(functionAppName)
83+
package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'

0 commit comments

Comments
 (0)