From 57eb05c0e380a19f8b77d86671801adddab4e09d Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Tue, 28 Jul 2020 23:25:55 +0200 Subject: [PATCH] Add job to update HassIO addon repo (#1218) --- .github/workflows/release.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c657655926..9f4efb590f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -222,13 +222,20 @@ jobs: dockerfile="docker/Dockerfile" fi + if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then + cache_tag="beta" + else + cache_tag="latest" + end + # Set env variables so these values don't need to be calculated again echo "::set-env name=BUILD_FROM::${build_from}" echo "::set-env name=BUILD_TO::${build_to}" echo "::set-env name=DOCKERFILE::${dockerfile}" + echo "::set-env name=CACHE_TAG::${cache_tag}" - name: Pull for cache run: | - docker pull "${BUILD_TO}:latest" || true + docker pull "${BUILD_TO}:${CACHE_TAG}" || true - name: Register QEMU binfmt run: docker run --rm --privileged multiarch/qemu-user-static:5.0.0-2 --reset -p yes - run: | @@ -236,7 +243,7 @@ jobs: --build-arg "BUILD_FROM=${BUILD_FROM}" \ --build-arg "BUILD_VERSION=${TAG}" \ --tag "${BUILD_TO}:${TAG}" \ - --cache-from "${BUILD_TO}:latest" \ + --cache-from "${BUILD_TO}:${CACHE_TAG}" \ --file "${DOCKERFILE}" \ . - name: Log in to docker hub @@ -300,3 +307,19 @@ jobs: esphome/esphome-amd64:${TAG} \ esphome/esphome-armv7:${TAG} docker manifest push esphome/esphome:latest + + deploy-hassio-repo: + if: github.repository == 'esphome/esphome' + runs-on: ubuntu-latest + needs: [deploy-docker] + steps: + - env: + TOKEN: ${{ secrets.DEPLOY_HASSIO_TOKEN }} + run: | + TAG="${GITHUB_REF#refs/tags/v}" + curl \ + -u ":$TOKEN" \ + -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/esphome/hassio/actions/workflows/bump-version.yml/dispatches \ + -d "{\"ref\":\"master\",\"inputs\":{\"version\":\"$TAG\"}}"