sainture
3/11/2019 - 11:29 PM

VSTS build steps

1. npm install
2. npm run lint
3. npm run build
4. Archive files (rootFolderOrFile: dist/project-name)
5. Copy Resource Group Template (SourceFolder: Templates/, Contents: '*.json', TargetFolder: '$(Build.ArtifactStagingDirectory)')
6. Publish Artifact
name: 1.0.$(BuildID)-$(SourceBranchName)
 
queue:
  name: Default
   
trigger:
  batch: true
  branches:
    include:
    - '*'

variables:
  BuildConfiguration: release
 
steps: 

- task: Npm@1
  displayName: 'npm install'
  inputs:
    verbose: false

- task: Npm@1
  displayName: 'npm run lint'
  inputs:
    command: custom
    verbose: false
    customCommand: 'run lint'

- task: Npm@1
  displayName: 'npm run build'
  inputs:
    command: custom
    verbose: false
    customCommand: 'run build-prod'

- task: ArchiveFiles@2
  displayName: 'Archive files'
  inputs:
    rootFolderOrFile: dist/introducers
    includeRootFolder: false

- task: CopyFiles@2
  displayName: 'Copy Resource Group Template'
  inputs:
    SourceFolder: Templates/
    TargetFolder: '$(Build.ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'



{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "environment": {
      "type": "string",
      "allowedValues": [
        "dev",
        "qa",
        "uat",
        "pilot",
        "prod"
      ]
    }
  },
  "variables": {
    "prefix": "test-",
     
    "location": "Test location", 
    "webAppName": "[concat(variables('prefix'), parameters('environment'))]",
     
    "servicePlan": "[concat('servicePlan-', parameters('environment'))]",
    "sharedResourceGroup": "[concat('sharedresources-', parameters('environment'))]",
    "serverFarmId": "[resourceId(variables('sharedResourceGroup'), 'Microsoft.Web/serverfarms', variables('servicePlan'))]"
  },
  "resources": [   
    {
      "comments": "Web app to run stuff.",
      "type": "Microsoft.Web/sites",
      "kind": "app",
      "name": "[variables('webAppName')]",
      "apiVersion": "2016-08-01",
      "location": "[variables('location')]",
      "scale": null,
      "identity": {
        "type": "SystemAssigned"
      },
      "properties": {
        "serverFarmId": "[variables('serverFarmId')]",
        "enabled": true,
        "reserved": false,
        "httpsOnly": true
      }
    },
    {
      "comments": "Web App Staging slot - if needed",
      "apiVersion": "2016-08-01",
      "condition": "[equals(parameters('environment'),'prod')]",
      "type": "Microsoft.Web/sites/slots",
      "name": "[concat(variables('webAppName'), '/', 'staging')]",
      "kind": "app",
      "location": "[variables('location')]",
      "tags": {
        "displayName": "WebAppSlots"
      },
      "properties": {
        "serverFarmId": "[variables('serverFarmId')]",
        "httpsOnly": true
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/Sites', variables('webAppName'))]"
      ]
    }
  ],
  "outputs": {
    "webAppName": {
      "type": "string",
      "value": "[variables('webAppName')]"
    },
	"webAppUrl": {
      "type": "string",
      "value": "[reference(variables('webAppName')).defaultHostName]"
    }
  }
}