From ddf2c6cc0fb6f0e805d4d0832b4ff3fd2354886b Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 17 Jul 2019 11:48:50 -0700 Subject: [PATCH] Add Azure pipelines for release --- azure-pipelines-release.yml | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 azure-pipelines-release.yml diff --git a/azure-pipelines-release.yml b/azure-pipelines-release.yml new file mode 100644 index 0000000000..64daaaa5a0 --- /dev/null +++ b/azure-pipelines-release.yml @@ -0,0 +1,68 @@ +# https://dev.azure.com/home-assistant + +trigger: + batch: true + tags: + include: + - "*" +pr: none +variables: + - name: versionBuilder + value: "5.2" + - group: docker + - group: github + - group: twine + +stages: + - stage: "Validate" + jobs: + - job: "VersionValidate" + pool: + vmImage: "ubuntu-latest" + steps: + - task: UsePythonVersion@0 + displayName: "Use Python 3.7" + inputs: + versionSpec: "3.7" + - script: | + setup_version="$(python setup.py -V)" + branch_version="$(Build.SourceBranchName)" + + if [ "${setup_version}" != "${branch_version}" ]; then + echo "Version of tag ${branch_version} don't match with ${setup_version}!" + exit 1 + fi + displayName: "Check version of branch/tag" + - 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/home-assistant/releases/tags/${release} | jq --raw-output '.author.login')" + + if [[ "${created_by}" =~ ^(balloob)$ ]]; then + exit 0 + fi + + echo "${created_by} is not allowed to create an release!" + exit 1 + displayName: "Check rights" + + - 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 12.1" + inputs: + versionSpec: "12.1" + - script: pip install twine wheel + displayName: "Install tools" + - script: script/release + displayName: "Build and release package"