75 linhas
2.0 KiB
YAML
75 linhas
2.0 KiB
YAML
# Node.js
|
|
# Build a general Node.js project with npm.
|
|
# Add steps that analyze code, save build artifacts, deploy, and more:
|
|
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
|
|
|
|
trigger:
|
|
- johnshew/login
|
|
|
|
variables:
|
|
# Azure Resource Manager connection created during pipeline creation
|
|
azureSubscription: 'fe7b93fe-e836-4a55-804c-883dbea6af24'
|
|
|
|
# Web app name
|
|
webAppName: 'vott'
|
|
|
|
# Agent VM image name
|
|
vmImageName: 'ubuntu-latest'
|
|
|
|
stages:
|
|
- stage: Build
|
|
displayName: Build stage
|
|
jobs:
|
|
- job: Build
|
|
displayName: Build
|
|
pool:
|
|
vmImage: $(vmImageName)
|
|
|
|
steps:
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: '10.x'
|
|
displayName: 'Install Node.js'
|
|
|
|
- script: |
|
|
npm install
|
|
npm run build --if-present
|
|
# npm run test --if-present
|
|
workingDirectory: $(System.DefaultWorkingDirectory)/server
|
|
displayName: 'npm install, build and test'
|
|
|
|
- task: ArchiveFiles@2
|
|
displayName: 'Archive files'
|
|
inputs:
|
|
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/server'
|
|
includeRootFolder: false
|
|
archiveType: zip
|
|
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
|
|
replaceExistingArchive: true
|
|
|
|
- upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
|
|
artifact: drop
|
|
|
|
- stage: Deploy
|
|
displayName: Deploy stage
|
|
dependsOn: Build
|
|
condition: succeeded()
|
|
jobs:
|
|
- deployment: Deploy
|
|
displayName: Deploy
|
|
environment: 'development'
|
|
pool:
|
|
vmImage: $(vmImageName)
|
|
strategy:
|
|
runOnce:
|
|
deploy:
|
|
steps:
|
|
- task: AzureWebApp@1
|
|
displayName: 'Azure Web App Deploy: vott'
|
|
inputs:
|
|
azureSubscription: $(azureSubscription)
|
|
appType: webAppLinux
|
|
appName: $(webAppName)
|
|
runtimeStack: 'NODE|10.10'
|
|
package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip
|
|
startUpCommand: 'npm run start' |