steps:
  - task: NodeTool@0
    inputs:
      versionSpec: "16.x"

  - task: AzureCLI@2
    inputs:
      azureSubscription: "vscode-builds-subscription"
      scriptType: pscore
      scriptLocation: inlineScript
      addSpnToEnvironment: true
      inlineScript: |
        Write-Host "##vso[task.setvariable variable=AZURE_TENANT_ID]$env:tenantId"
        Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_ID]$env:servicePrincipalId"
        Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_SECRET;issecret=true]$env:servicePrincipalKey"

  - script: |
      set -e
      (cd build ; yarn)
      AZURE_TENANT_ID="$(AZURE_TENANT_ID)" \
      AZURE_CLIENT_ID="$(AZURE_CLIENT_ID)" \
      AZURE_CLIENT_SECRET="$(AZURE_CLIENT_SECRET)" \
      node build/azure-pipelines/common/releaseBuild.js
