# https://dev.azure.com/home-assistant

trigger:
  batch: true
  tags:
    include:
      - "*"
pr: none
variables:
  - name: versionWheels
    value: '1.3-3.7-alpine3.10'
  - name: versionNode
    value: '12.1'
  - group: twine
resources:
  repositories:
    - repository: azure
      type: github
      name: 'home-assistant/ci-azure'
      endpoint: 'home-assistant'


stages:
  - stage: "Validate"
    jobs:
    - template: templates/azp-job-version.yaml@azure

  - stage: "Build"
    jobs:
      - job: "ReleasePython"
        pool:
          vmImage: "ubuntu-latest"
        steps:
          - task: UsePythonVersion@0
            displayName: "Use Python 3.7"
            inputs:
              versionSpec: "3.7"
          - task: NodeTool@0
            displayName: "Use Node $(versionNode)"
            inputs:
              versionSpec: "$(versionNode)"
          - script: pip install twine wheel
            displayName: "Install tools"
          - script: |
              export TWINE_USERNAME="$(twineUser)"
              export TWINE_PASSWORD="$(twinePassword)"

              script/release
            displayName: "Build and release package"
      - template: templates/azp-job-wheels.yaml@azure
        parameters:
          builderVersion: '$(versionWheels)'
          builderApk: 'build-base'
          wheelsLocal: true
          preBuild:
          - task: NodeTool@0
            displayName: "Use Node $(versionNode)"
            inputs:
              versionSpec: "$(versionNode)"
          - script: |
              set -e

              yarn install
              script/build_frontend
