From 257b45b77792cd57d6f8b2b419690889f9b7fe6d Mon Sep 17 00:00:00 2001 From: Max Winterstein Date: Mon, 15 Feb 2021 07:58:42 +0100 Subject: [PATCH] Update eufy-ha-mqtt-bridge to prebuild images --- .../eufy_create_mr_and_build_image.yaml | 52 +++++++++---------- eufy-ha-mqtt-bridge/CHANGELOG.md | 7 +++ eufy-ha-mqtt-bridge/Dockerfile | 19 ++++++- eufy-ha-mqtt-bridge/Dockerfile-real | 19 ------- eufy-ha-mqtt-bridge/README.md | 6 +++ eufy-ha-mqtt-bridge/build.json | 9 ++++ eufy-ha-mqtt-bridge/config.json | 6 ++- eufy-ha-mqtt-bridge/version-updater.sh | 5 +- 8 files changed, 71 insertions(+), 52 deletions(-) delete mode 100644 eufy-ha-mqtt-bridge/Dockerfile-real create mode 100644 eufy-ha-mqtt-bridge/build.json diff --git a/.github/workflows/eufy_create_mr_and_build_image.yaml b/.github/workflows/eufy_create_mr_and_build_image.yaml index 3d18e04..40698c4 100644 --- a/.github/workflows/eufy_create_mr_and_build_image.yaml +++ b/.github/workflows/eufy_create_mr_and_build_image.yaml @@ -11,25 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - run: cd eufy-ha-mqtt-bridge && ./version-updater.sh - - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 - with: - title: Update eufy-mqtt-ha-bridge to version ${{ env.MQTT_BRIDGE_VERSION }} - commit-message: Update eufy-mqtt-ha-bridge to version ${{ env.MQTT_BRIDGE_VERSION }} - committer: Max Winterstein - author: Max Winterstein - assignees: MaxWinterstein - body: | - Update report - - Update related files of eufy-mqtt-ha-bridge to version ${{ env.MQTT_BRIDGE_VERSION }} [Changelog][1] - - Build docker image, check [DockerHub][2] - - [1]: https://github.com/matijse/eufy-ha-mqtt-bridge/releases - [2]: https://hub.docker.com/r/maxwinterstein/homeassistant-addon-eufy-ha-mqtt-bridge - if: ${{ env.CONTINUE }} - - name: Set up QEMU uses: docker/setup-qemu-action@v1 if: ${{ env.CONTINUE }} @@ -44,14 +28,30 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} if: ${{ env.CONTINUE }} - - - name: Build and push - uses: docker/build-push-action@v2 + + - name: Test build + uses: home-assistant/builder@master with: - context: eufy-ha-mqtt-bridge/ - file: eufy-ha-mqtt-bridge/Dockerfile-real - platforms: linux/amd64,linux/arm/v7,linux/arm64 - push: true - tags: | - maxwinterstein/homeassistant-addon-eufy-ha-mqtt-bridge:${{ env.ADDON_NEXT_VERSION }} + args: | + --all \ + --aarch64 \ + --target eufy-ha-mqtt-bridge \ + --docker-hub maxwinterstein + if: ${{ env.CONTINUE }} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + title: Update eufy-mqtt-ha-bridge to version ${{ env.MQTT_BRIDGE_VERSION }} + commit-message: Update eufy-mqtt-ha-bridge to version ${{ env.MQTT_BRIDGE_VERSION }} + committer: Max Winterstein + author: Max Winterstein + assignees: MaxWinterstein + body: | + Update report + - Update related files of eufy-mqtt-ha-bridge to version ${{ env.MQTT_BRIDGE_VERSION }} [Changelog][1] + - Build docker image, check [DockerHub][2] + + [1]: https://github.com/matijse/eufy-ha-mqtt-bridge/releases + [2]: https://hub.docker.com/r/maxwinterstein/ if: ${{ env.CONTINUE }} diff --git a/eufy-ha-mqtt-bridge/CHANGELOG.md b/eufy-ha-mqtt-bridge/CHANGELOG.md index 03225df..94a3ac2 100644 --- a/eufy-ha-mqtt-bridge/CHANGELOG.md +++ b/eufy-ha-mqtt-bridge/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.10.0] - 2021-02-14 +- Use Pre-build containers (no more unused docker images, yay). + **🚨 !!Important Update Notice!! 🚨** + The Update progress might fail when the installed version is <1.10.0. + Copy your *Configuration* to your clipboard and Uninstall/Install manually. + + ## [1.9.0] - 2021-02-05 - Update `eufy-ha-mqtt-bridge` to `0.2.10` [Changelog](https://github.com/matijse/eufy-ha-mqtt-bridge/releases) - Add new configration option `mqtt.keepalive` diff --git a/eufy-ha-mqtt-bridge/Dockerfile b/eufy-ha-mqtt-bridge/Dockerfile index ed44afe..6c32619 100644 --- a/eufy-ha-mqtt-bridge/Dockerfile +++ b/eufy-ha-mqtt-bridge/Dockerfile @@ -1,3 +1,18 @@ -# sneaky trick to get around the requirement of {arch}-variabe based docker repositories +ARG BUILD_FROM +FROM $BUILD_FROM -FROM maxwinterstein/homeassistant-addon-eufy-ha-mqtt-bridge:1.9.0 \ No newline at end of file +ARG VERSION=0.2.10 + +RUN apk add --no-cache nodejs npm make g++ + +# add source and unpack +ADD "https://github.com/matijse/eufy-ha-mqtt-bridge/archive/${VERSION}.tar.gz" /src.tar.gz +RUN mkdir /app && tar xvfz /src.tar.gz -C /app --strip-components=1 + +# install all (and json2yaml for cofiguration parsing) +WORKDIR /app +RUN npm install && npm install -g json2yaml && echo ${VERSION} > /version + +COPY run.sh / +RUN chmod a+x /run.sh +CMD [ "/run.sh" ] \ No newline at end of file diff --git a/eufy-ha-mqtt-bridge/Dockerfile-real b/eufy-ha-mqtt-bridge/Dockerfile-real deleted file mode 100644 index 70f5701..0000000 --- a/eufy-ha-mqtt-bridge/Dockerfile-real +++ /dev/null @@ -1,19 +0,0 @@ -FROM hassioaddons/debian-base -ENV LANG C.UTF-8 - -ARG VERSION=0.2.10 - -# install node and build tools (needed by node-pre-gy) -RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt install -y nodejs g++ make python - -# add source and unpack -ADD "https://github.com/matijse/eufy-ha-mqtt-bridge/archive/${VERSION}.tar.gz" /src.tar.gz -RUN mkdir /app && tar xvfz /src.tar.gz -C /app --strip-components=1 - -# install all (and json2yaml for cofiguration parsing) -WORKDIR /app -RUN npm install && npm install -g json2yaml && echo ${VERSION} > /version - -COPY run.sh / -RUN chmod a+x /run.sh -CMD [ "/run.sh" ] diff --git a/eufy-ha-mqtt-bridge/README.md b/eufy-ha-mqtt-bridge/README.md index 95690ba..444b644 100644 --- a/eufy-ha-mqtt-bridge/README.md +++ b/eufy-ha-mqtt-bridge/README.md @@ -1,3 +1,9 @@ +--- +# 🚨 !!Important Update Notice!! 🚨 +This addon recently switched to pre-build images. The Update progress might fail when the installed version is <0.6.0. +Copy your *Configuration* to your clipboard and Uninstall/Install manually. +--- + # Home Assistant Add-on: Eufy Home Assistant MQTT Bridge ## Based on https://github.com/matijse/eufy-ha-mqtt-bridge/ diff --git a/eufy-ha-mqtt-bridge/build.json b/eufy-ha-mqtt-bridge/build.json new file mode 100644 index 0000000..54f13c7 --- /dev/null +++ b/eufy-ha-mqtt-bridge/build.json @@ -0,0 +1,9 @@ +{ + "build_from": { + "aarch64": "ghcr.io/hassio-addons/base-python/aarch64:6.0.0", + "amd64": "ghcr.io/hassio-addons/base-python/amd64:6.0.0", + "armhf": "ghcr.io/hassio-addons/base-python/armhf:6.0.0", + "armv7": "ghcr.io/hassio-addons/base-python/armv7:6.0.0", + "i386": "ghcr.io/hassio-addons/base-python/i386:6.0.0" + } +} \ No newline at end of file diff --git a/eufy-ha-mqtt-bridge/config.json b/eufy-ha-mqtt-bridge/config.json index 6b5973a..145d3a1 100644 --- a/eufy-ha-mqtt-bridge/config.json +++ b/eufy-ha-mqtt-bridge/config.json @@ -1,13 +1,15 @@ { "name": "Eufy Home Assistant MQTT Bridge", - "version": "1.9.0", + "version": "1.10.0", "slug": "eufy-ha-mqtt-bridge", + "image": "maxwinterstein/homeassistant-addon-eufy-ha-mqtt-bridge-{arch}", "description": "Publish events as MQTT messages", "arch": [ "armhf", "armv7", "aarch64", - "amd64" + "amd64", + "i386" ], "startup": "application", "boot": "auto", diff --git a/eufy-ha-mqtt-bridge/version-updater.sh b/eufy-ha-mqtt-bridge/version-updater.sh index 1636ebb..0ca3261 100755 --- a/eufy-ha-mqtt-bridge/version-updater.sh +++ b/eufy-ha-mqtt-bridge/version-updater.sh @@ -5,7 +5,7 @@ echo "Newest version of eufy-ha-mqtt-bridge: $MQTT_BRIDGE_VERSION" echo "MQTT_BRIDGE_VERSION=$MQTT_BRIDGE_VERSION" >> $GITHUB_ENV echo "Check if $MQTT_BRIDGE_VERSION is already used..." -grep "ARG VERSION=${MQTT_BRIDGE_VERSION}" Dockerfile-real && { echo "Version is the same, nothing to do"; exit 0; } || echo "Version is different, will continue..." +grep "ARG VERSION=${MQTT_BRIDGE_VERSION}" Dockerfile && { echo "Version is the same, nothing to do"; exit 0; } || echo "Version is different, will continue..." echo "CONTINUE=true" >> $GITHUB_ENV; echo "Reading current addon version" @@ -16,8 +16,7 @@ echo "Update config..." sed -i.bak "s|\ \ \"version\": \".*$|\ \ \"version\": \"$ADDON_NEXT_VERSION\",|" config.json echo "Update Dockerfile..." -sed -i.bak "s|eufy-ha-mqtt-bridge:.*$|eufy-ha-mqtt-bridge:${ADDON_NEXT_VERSION}|" Dockerfile -sed -i.bak "s|VERSION=.*$|VERSION=${MQTT_BRIDGE_VERSION}|" Dockerfile-real +sed -i.bak "s|VERSION=.*$|VERSION=${MQTT_BRIDGE_VERSION}|" Dockerfile echo "Update CHANGELOG..." sed -i.bak "2 a ## [${ADDON_NEXT_VERSION}] - $(date +%Y-%m-%d)" CHANGELOG.md