Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
azure-pipelines-release.yml 10.13 KiB
# https://dev.azure.com/home-assistant

trigger:
  tags:
    include:
      - '*'
pr: none
schedules:
  - cron: "0 1 * * *"
    displayName: "nightly builds"
    branches:
      include:
        - dev
    always: true
variables:
  - name: versionBuilder
    value: '2020.11.0'
  - group: docker
  - group: github
  - 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
    parameters:
      ignoreDev: true
  - job: 'Permission'
    pool:
      vmImage: 'ubuntu-latest'
    steps:
    - script: |
        sudo apt-get install -y --no-install-recommends \
          jq curl

        release="$(Build.SourceBranchName)"
        created_by="$(curl -s https://api.github.com/repos/home-assistant/core/releases/tags/${release} | jq --raw-output '.author.login')"

        if [[ "${created_by}" =~ ^(balloob|pvizeli|fabaff|robbiet480|bramkragten|frenck)$ ]]; then
          exit 0
        fi

        echo "${created_by} is not allowed to create an release!"
        exit 1
      displayName: 'Check rights'
      condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))

- stage: 'Build'
  jobs:
  - job: 'ReleasePython'
    condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
    pool:
      vmImage: 'ubuntu-latest'
    steps:
    - task: UsePythonVersion@0
      displayName: 'Use Python 3.7'
      inputs:
        versionSpec: '3.7'
    - script: pip install twine wheel
      displayName: 'Install tools'
    - script: python setup.py sdist bdist_wheel
      displayName: 'Build package'
    - script: |