-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
93 lines (81 loc) · 2.61 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
trigger:
branches:
include:
- master
paths:
exclude:
- azure-deploy.json
- azure-pipelines.yml
stages:
- stage: Build Application
jobs:
- job: Build
pool:
vmImage: 'Ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
npm install
displayName: 'npm install'
- script: |
npm test
displayName: 'npm test'
- task: ArchiveFiles@2
displayName: 'Archive files'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
includeRootFolder: false
- task: PublishBuildArtifacts@1
displayName: 'Publish artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'nodejsap'
publishLocation: 'Container'
- stage: Release Pipeline
jobs:
- job: Create
pool:
vmImage: 'ubuntu-latest'
variables:
LOCATION: 'westeurope'
RG: 'nodejsapprg'
SERVPLAN: 'nodejsappsp'
WEBAPP: 'nodejsapplication001'
steps:
- task: AzureCLI@2
displayName: 'Creating Resource Group'
inputs:
azureSubscription: 'Azure Free Subscription'
scriptType: bash
scriptLocation: inlineScript
inlineScript: 'az group create --location $(LOCATION) --name $(RG)'
- task: AzureCLI@2
displayName: 'Create Application Service Plan'
inputs:
azureSubscription: 'Azure Free Subscription'
scriptType: bash
scriptLocation: inlineScript
inlineScript: 'az appservice plan create --resource-group $(RG) --name $(SERVPLAN) --location $(LOCATION) --is-linux --sku S1'
- task: AzureCLI@2
displayName: 'Creating Web Application'
inputs:
azureSubscription: 'Azure Free Subscription'
scriptType: bash
scriptLocation: inlineScript
inlineScript: 'az webapp create --resource-group $(RG) --plan $(SERVPLAN) --name $(WEBAPP) --runtime "node|10.14"'
- task: AzureRmWebAppDeployment@4
displayName: 'Azure App Service Deploy'
inputs:
azureSubscription: 'Azure Free Subscription'
appType: webAppLinux
WebAppName: '$(WEBAPP)'
- task: AzureCLI@2
displayName: 'Remove Azure Resources'
inputs:
azureSubscription: 'Azure Free Subscription'
scriptType: bash
scriptLocation: inlineScript
inlineScript: 'az group delete --name $(RG) --no-wait --yes'