Simplify and enable caching

This commit is contained in:
Otto Winter 2020-07-14 15:10:26 +02:00
parent 3d78248aaf
commit 01b1b688b1
No known key found for this signature in database
GPG key ID: 48ED2DDB96D7682C
2 changed files with 14 additions and 17 deletions

View file

@ -165,15 +165,12 @@ jobs:
if [[ "${{ matrix.build_type }}" == "hassio" ]]; then
build_from="esphome/esphome-hassio-base-${{ matrix.arch }}:${base_version}"
build_to="esphome/esphome-hassio-${{ matrix.arch }}"
build_to="${{ github.repository }}-hassio-${{ matrix.arch }}"
dockerfile="docker/Dockerfile.hassio"
else
build_from="esphome/esphome-base-${{ matrix.arch }}:${base_version}"
build_to="esphome/esphome-${{ matrix.arch }}"
build_to="${{ github.repository }}-${{ matrix.arch }}"
dockerfile="docker/Dockerfile"
if [[ "${{ matrix.arch }}" == "amd64" ]]; then
build_to="esphome/esphome"
fi
fi
# Set env variables so these values don't need to be calculated again
@ -190,6 +187,9 @@ jobs:
--build-arg "BUILD_VERSION=${TAG}" \
--tag "${IMAGE}" \
--file "${DOCKERFILE}" \
--cache-from "${{ github.repository }}:latest"
--cache-from "${{ github.repository }}:beta"
--cache-from "${{ github.repository }}:dev"
.
- name: Log in to docker hub
env:
@ -213,7 +213,7 @@ jobs:
run: docker login -u "${DOCKER_USER}" -p "${DOCKER_PASSWORD}"
- name: "Create the manifest"
run: |
REPO=esphome/esphome
REPO=${{ github.repository }}
TAG="dev"
docker manifest create ${REPO}:${TAG} \
@ -221,6 +221,4 @@ jobs:
${REPO}-amd64:${TAG} \
${REPO}-armv7:${TAG} \
${REPO}-i386:${TAG}
echo "::set-env name=TAG::${TAG}"
echo "::set-env name=REPO::${REPO}"
- run: docker push ${REPO}:${TAG}
docker push ${REPO}:${TAG}

View file

@ -186,15 +186,12 @@ jobs:
if [[ "${{ matrix.build_type }}" == "hassio" ]]; then
build_from="esphome/esphome-hassio-base-${{ matrix.arch }}:${base_version}"
build_to="esphome/esphome-hassio-${{ matrix.arch }}"
build_to="${{ github.repository }}-hassio-${{ matrix.arch }}"
dockerfile="docker/Dockerfile.hassio"
else
build_from="esphome/esphome-base-${{ matrix.arch }}:${base_version}"
build_to="esphome/esphome-${{ matrix.arch }}"
build_to="${{ github.repository }}-${{ matrix.arch }}"
dockerfile="docker/Dockerfile"
if [[ "${{ matrix.arch }}" == "amd64" ]]; then
build_to="esphome/esphome"
fi
fi
# Set env variables so these values don't need to be calculated again
@ -211,6 +208,9 @@ jobs:
--build-arg "BUILD_VERSION=${TAG}" \
--tag "${IMAGE}" \
--file "${DOCKERFILE}" \
--cache-from "${{ github.repository }}:latest"
--cache-from "${{ github.repository }}:beta"
--cache-from "${{ github.repository }}:dev"
.
- name: Log in to docker hub
env:
@ -244,7 +244,7 @@ jobs:
run: docker login -u "${DOCKER_USER}" -p "${DOCKER_PASSWORD}"
- name: "Create the manifest"
run: |
REPO=esphome/esphome
REPO=${{ github.repository }}
TAG="${GITHUB_REF#v}"
docker manifest create ${REPO}:${TAG} \
@ -252,9 +252,8 @@ jobs:
${REPO}-amd64:${TAG} \
${REPO}-armv7:${TAG} \
${REPO}-i386:${TAG}
echo "::set-env name=TAG::${TAG}"
echo "::set-env name=REPO::${REPO}"
- run: docker push ${REPO}:${TAG}
docker push ${REPO}:${TAG}
- name: Publish docker beta tag
if: ${{ github.event.release.prerelease) }}