2019-05-01 07:54:48 +00:00
|
|
|
# https://dev.azure.com/home-assistant
|
|
|
|
|
|
|
|
trigger:
|
2019-05-01 12:42:52 +00:00
|
|
|
batch: true
|
2019-05-01 07:54:48 +00:00
|
|
|
tags:
|
|
|
|
include:
|
|
|
|
- '*'
|
2019-06-05 07:24:14 +00:00
|
|
|
pr: none
|
2019-05-01 07:54:48 +00:00
|
|
|
variables:
|
2019-05-02 17:00:39 +00:00
|
|
|
- name: versionBuilder
|
2019-06-27 16:26:13 +00:00
|
|
|
value: '4.5'
|
2019-05-02 17:00:39 +00:00
|
|
|
- group: docker
|
2019-05-14 08:18:01 +00:00
|
|
|
- group: github
|
2019-05-31 08:53:34 +00:00
|
|
|
- group: twine
|
2019-05-01 07:54:48 +00:00
|
|
|
|
2019-05-30 15:35:47 +00:00
|
|
|
|
2019-05-01 07:54:48 +00:00
|
|
|
jobs:
|
|
|
|
|
2019-05-02 08:29:16 +00:00
|
|
|
|
2019-05-30 15:35:47 +00:00
|
|
|
- job: 'VersionValidate'
|
2019-05-02 08:29:16 +00:00
|
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
|
2019-05-30 15:35:47 +00:00
|
|
|
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'
|
2019-05-31 08:53:34 +00:00
|
|
|
- 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|pvizeli|fabaff|robbiet480)$ ]]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "${created_by} is not allowed to create an release!"
|
|
|
|
exit 1
|
|
|
|
displayName: 'Check rights'
|
|
|
|
|
|
|
|
|
|
|
|
- job: 'ReleasePython'
|
|
|
|
condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags'), succeeded('VersionValidate'))
|
|
|
|
dependsOn:
|
|
|
|
- 'VersionValidate'
|
|
|
|
pool:
|
|
|
|
vmImage: 'ubuntu-latest'
|
|
|
|
steps:
|
|
|
|
- task: UsePythonVersion@0
|
|
|
|
displayName: 'Use Python 3.7'
|
|
|
|
inputs:
|
|
|
|
versionSpec: '3.7'
|
2019-05-31 21:10:09 +00:00
|
|
|
- script: pip install twine wheel
|
|
|
|
displayName: 'Install tools'
|
2019-05-31 08:53:34 +00:00
|
|
|
- script: python setup.py sdist bdist_wheel
|
|
|
|
displayName: 'Build package'
|
|
|
|
- script: |
|
|
|
|
export TWINE_USERNAME="$(twineUser)"
|
|
|
|
export TWINE_PASSWORD="$(twinePassword)"
|
|
|
|
|
|
|
|
twine upload dist/* --skip-existing
|
|
|
|
displayName: 'Upload pypi'
|
2019-05-30 15:35:47 +00:00
|
|
|
|
|
|
|
|
2019-05-31 08:53:34 +00:00
|
|
|
- job: 'ReleaseDocker'
|
2019-05-30 16:46:08 +00:00
|
|
|
condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags'), succeeded('VersionValidate'))
|
2019-05-30 15:35:47 +00:00
|
|
|
dependsOn:
|
|
|
|
- 'VersionValidate'
|
2019-06-05 20:14:03 +00:00
|
|
|
timeoutInMinutes: 240
|
2019-05-02 08:29:16 +00:00
|
|
|
pool:
|
2019-05-31 08:53:34 +00:00
|
|
|
vmImage: 'ubuntu-latest'
|
2019-05-02 08:29:16 +00:00
|
|
|
strategy:
|
|
|
|
maxParallel: 5
|
|
|
|
matrix:
|
|
|
|
amd64:
|
|
|
|
buildArch: 'amd64'
|
|
|
|
buildMachine: 'qemux86-64,intel-nuc'
|
|
|
|
i386:
|
|
|
|
buildArch: 'i386'
|
|
|
|
buildMachine: 'qemux86'
|
|
|
|
armhf:
|
|
|
|
buildArch: 'armhf'
|
|
|
|
buildMachine: 'qemuarm,raspberrypi'
|
|
|
|
armv7:
|
|
|
|
buildArch: 'armv7'
|
|
|
|
buildMachine: 'raspberrypi2,raspberrypi3,odroid-xu,tinker'
|
|
|
|
aarch64:
|
|
|
|
buildArch: 'aarch64'
|
|
|
|
buildMachine: 'qemuarm-64,raspberrypi3-64,odroid-c2,orangepi-prime'
|
|
|
|
steps:
|
|
|
|
- script: sudo docker login -u $(dockerUser) -p $(dockerPassword)
|
|
|
|
displayName: 'Docker hub login'
|
|
|
|
- script: sudo docker pull homeassistant/amd64-builder:$(versionBuilder)
|
|
|
|
displayName: 'Install Builder'
|
|
|
|
- script: |
|
|
|
|
set -e
|
|
|
|
|
|
|
|
sudo docker run --rm --privileged \
|
|
|
|
-v ~/.docker:/root/.docker \
|
|
|
|
-v /run/docker.sock:/run/docker.sock:rw \
|
|
|
|
homeassistant/amd64-builder:$(versionBuilder) \
|
|
|
|
--homeassistant $(Build.SourceBranchName) "--$(buildArch)" \
|
|
|
|
-r https://github.com/home-assistant/hassio-homeassistant \
|
|
|
|
-t generic --docker-hub homeassistant
|
|
|
|
|
|
|
|
sudo docker run --rm --privileged \
|
|
|
|
-v ~/.docker:/root/.docker \
|
|
|
|
-v /run/docker.sock:/run/docker.sock:rw \
|
|
|
|
homeassistant/amd64-builder:$(versionBuilder) \
|
|
|
|
--homeassistant-machine "$(Build.SourceBranchName)=$(buildMachine)" \
|
|
|
|
-r https://github.com/home-assistant/hassio-homeassistant \
|
|
|
|
-t machine --docker-hub homeassistant
|
|
|
|
displayName: 'Build Release'
|
2019-05-14 08:18:01 +00:00
|
|
|
|
|
|
|
|
2019-05-31 08:53:34 +00:00
|
|
|
- job: 'ReleaseHassio'
|
|
|
|
condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags'), succeeded('ReleaseDocker'))
|
2019-05-14 08:18:01 +00:00
|
|
|
dependsOn:
|
2019-05-31 08:53:34 +00:00
|
|
|
- 'ReleaseDocker'
|
2019-05-14 08:18:01 +00:00
|
|
|
pool:
|
2019-05-31 08:53:34 +00:00
|
|
|
vmImage: 'ubuntu-latest'
|
2019-05-14 08:18:01 +00:00
|
|
|
steps:
|
|
|
|
- script: |
|
|
|
|
sudo apt-get install -y --no-install-recommends \
|
2019-05-31 08:53:34 +00:00
|
|
|
git jq curl
|
2019-05-14 08:18:01 +00:00
|
|
|
|
|
|
|
git config --global user.name "Pascal Vizeli"
|
|
|
|
git config --global user.email "pvizeli@syshack.ch"
|
|
|
|
git config --global credential.helper store
|
|
|
|
|
2019-05-17 07:39:36 +00:00
|
|
|
echo "https://$(githubToken):x-oauth-basic@github.com" > $HOME/.git-credentials
|
2019-05-14 08:18:01 +00:00
|
|
|
displayName: 'Install requirements'
|
|
|
|
- script: |
|
|
|
|
set -e
|
|
|
|
|
|
|
|
version="$(Build.SourceBranchName)"
|
|
|
|
|
|
|
|
git clone https://github.com/home-assistant/hassio-version
|
|
|
|
cd hassio-version
|
|
|
|
|
|
|
|
dev_version="$(jq --raw-output '.homeassistant.default' dev.json)"
|
|
|
|
beta_version="$(jq --raw-output '.homeassistant.default' beta.json)"
|
|
|
|
stable_version="$(jq --raw-output '.homeassistant.default' stable.json)"
|
|
|
|
|
|
|
|
if [[ "$version" =~ b ]]; then
|
|
|
|
sed -i "s|$dev_version|$version|g" dev.json
|
|
|
|
sed -i "s|$beta_version|$version|g" beta.json
|
|
|
|
else
|
|
|
|
sed -i "s|$dev_version|$version|g" dev.json
|
|
|
|
sed -i "s|$beta_version|$version|g" beta.json
|
|
|
|
sed -i "s|$stable_version|$version|g" stable.json
|
|
|
|
fi
|
|
|
|
|
|
|
|
git commit -am "Bump Home Assistant $version"
|
|
|
|
git push
|
2019-05-23 07:46:40 +00:00
|
|
|
displayName: 'Update version files'
|