diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 5645fa7..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: ci - -on: - push: - branches: main - -jobs: - multi: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - file: ./Dockerfile - platforms: linux/amd64,linux/arm/v7,linux/arm64 - push: true - tags: | - sibbl/hass-lovelace-kindle-screensaver:latest diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..556b32f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,74 @@ +name: Docker build and publish + +on: + release: + types: [published] + +jobs: + build-amd64: + name: Build and publish amd64 image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Get version + env: + TAG_NAME: ${{ github.event.release.tag_name }} + run: echo "VERSION=${TAG_NAME#v}" >> $GITHUB_ENV + - name: Patch files + uses: onlyutkarsh/patch-files-action@v1.0.1 + with: + files: | + lovelace-kindle-screensaver/config.json + patch-syntax: | + = /version => "${{ env.VERSION }}" + - name: publish amd64 docker files + if: github.event_name != 'pull_request' + run: docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v ~/.docker:/root/.docker -v "$(pwd)":/data homeassistant/amd64-builder -t lovelace-kindle-screensaver --amd64 --release-tag --docker-user marciogranzotto --docker-password ${{ secrets.DOCKER_PASSWORD }} + build-armv7: + name: Build and publish armv7 image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Get version + env: + TAG_NAME: ${{ github.event.release.tag_name }} + run: echo "VERSION=${TAG_NAME#v}" >> $GITHUB_ENV + - name: Patch files + uses: onlyutkarsh/patch-files-action@v1.0.1 + with: + files: | + lovelace-kindle-screensaver/config.json + patch-syntax: | + = /version => "${{ env.VERSION }}" + - name: publish armv7 docker files + if: github.event_name != 'pull_request' + run: docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v ~/.docker:/root/.docker -v "$(pwd)":/data homeassistant/amd64-builder -t lovelace-kindle-screensaver --armv7 --release-tag --docker-user marciogranzotto --docker-password ${{ secrets.DOCKER_PASSWORD }} + build-aarch64: + name: Build and publish aarch64 image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Get version + env: + TAG_NAME: ${{ github.event.release.tag_name }} + run: echo "VERSION=${TAG_NAME#v}" >> $GITHUB_ENV + - name: Patch files + uses: onlyutkarsh/patch-files-action@v1.0.1 + with: + files: | + lovelace-kindle-screensaver/config.json + patch-syntax: | + = /version => "${{ env.VERSION }}" + + - name: publish aarch64 docker files + if: github.event_name != 'pull_request' + run: docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v ~/.docker:/root/.docker -v "$(pwd)":/data homeassistant/amd64-builder -t lovelace-kindle-screensaver --aarch64 --release-tag --docker-user marciogranzotto --docker-password ${{ secrets.DOCKER_PASSWORD }} + update-main-repo: + needs: [build-amd64, build-armv7, build-aarch64, build-i386, build-armhf] + name: Update addons repository + runs-on: ubuntu-latest + container: + image: hassioaddons/repository-updater:latest + steps: + - name: upload + run: repository-updater --token ${{ secrets.GIT_TOKEN }} --repository marciogranzotto/addons-repository --addon lovelace-kindle-screensaver diff --git a/lovelace-kindle-screensaver/Dockerfile b/lovelace-kindle-screensaver/Dockerfile index 0cea5c6..65d86e1 100644 --- a/lovelace-kindle-screensaver/Dockerfile +++ b/lovelace-kindle-screensaver/Dockerfile @@ -11,15 +11,15 @@ RUN apk add --no-cache \ --repository=https://mirror.fsmg.org.nz/alpine/v3.9/main RUN apk add --no-cache \ - nss=3.60.1-r0 \ + nss=3.63-r0 \ freetype=2.10.4-r1 \ freetype-dev=2.10.4-r1 \ harfbuzz=2.7.4-r1 \ ca-certificates=20191127-r5 \ ttf-freefont=20120503-r1 \ imagemagick=7.0.10.57-r0 \ - nodejs=14.16.0-r0 \ - npm=14.16.0-r0 + nodejs=14.16.1-r0 \ + npm=14.16.1-r0 ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \ PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \ @@ -44,12 +44,12 @@ LABEL \ io.hass.type="addon" \ io.hass.version=${BUILD_VERSION} \ maintainer="Marcio Granzotto " \ - org.opencontainers.image.title="Transmission" \ + org.opencontainers.image.title="Lovelace Kindle Screensaver" \ org.opencontainers.image.description="Display a lovelace page as a screensaver on a jailbroken Kindle" \ org.opencontainers.image.vendor="Marcio Granzotto" \ org.opencontainers.image.authors="Marcio Granzotto " \ - org.opencontainers.image.source="https://github.com/sibbl/hass-lovelace-kindle-screensaver" \ - org.opencontainers.image.documentation="https://github.com/sibbl/hass-lovelace-kindle-screensaver/blob/master/README.md" \ + org.opencontainers.image.source="https://github.com/marciogranzotto/hass-lovelace-kindle-screensaver" \ + org.opencontainers.image.documentation="https://github.com/marciogranzotto/hass-lovelace-kindle-screensaver/blob/master/README.md" \ org.opencontainers.image.created=${BUILD_DATE} \ org.opencontainers.image.revision=${BUILD_REF} \ org.opencontainers.image.version=${BUILD_VERSION} diff --git a/lovelace-kindle-screensaver/config.json b/lovelace-kindle-screensaver/config.json index e03b871..3ce1a0c 100644 --- a/lovelace-kindle-screensaver/config.json +++ b/lovelace-kindle-screensaver/config.json @@ -3,9 +3,9 @@ "version": "1.0.0", "slug": "lovelace-kindle-screensaver", "description": "Display a lovelace page as a screensaver on a jailbroken Kindle", - "url": "https://github.com/sibbl/hass-lovelace-kindle-screensaver", + "url": "https://github.com/marciogranzotto/hass-lovelace-kindle-screensaver", "webui": "http://[HOST]:[PORT:5000]/output/cover.png", - "image": "sibbl/addon-lovelace-kindle-screensaver-{arch}", + "image": "marciogranzotto/addon-lovelace-kindle-screensaver-{arch}", "startup": "application", "arch": ["armv7", "aarch64", "amd64"], "map": [ @@ -24,11 +24,13 @@ "privileged": [ "SYS_ADMIN","DAC_READ_SEARCH" ], + "auth_api": true, "hassio_api": true, "hassio_role": "default", - "homeassistant_api": false, + "homeassistant_api": true, "host_network": false, "options": { + "ha_token": "!secret kindle_ha_token", "screenshot_path": "/lovelace?kiosk", "cron_job": "* * * * *", "rendering_timeout": 30000, @@ -38,9 +40,11 @@ "grayscale_depth": 8, "language": "en", "rotation": 0, - "scaling": 1 + "scaling": 1, + "log_level": "info" }, "schema": { + "ha_token": "str", "screenshot_path": "str", "cron_job": "str", "rendering_timeout": "int", @@ -50,7 +54,8 @@ "grayscale_depth": "int", "language": "str", "rotation": "int", - "scaling": "int" + "scaling": "int", + "log_level": "list(trace|debug|info|notice|warning|error|fatal)?" }, "environment": { "LOG_FORMAT": "{LEVEL}: {MESSAGE}", diff --git a/lovelace-kindle-screensaver/rootfs/etc/services.d/node/run b/lovelace-kindle-screensaver/rootfs/etc/services.d/node/run old mode 100644 new mode 100755 index c41f403..7f49e57 --- a/lovelace-kindle-screensaver/rootfs/etc/services.d/node/run +++ b/lovelace-kindle-screensaver/rootfs/etc/services.d/node/run @@ -4,17 +4,22 @@ # ============================================================================== bashio::log.info "Starting Node server..." -HA_BASE_URL=$(bashio::config 'ha_base_url') -HA_SCREENSHOT_URL=$(bashio::config 'ha_screenshot_url') -HA_ACCESS_TOKEN=$(bashio::config 'ha_access_token') -CRON_JOB=$(bashio::config 'cron_job') -RENDERING_TIMEOUT=$(bashio::config 'rendering_timeout') -RENDERING_DELAY=$(bashio::config 'rendering_delay') -RENDERING_SCREEN_HEIGHT=$(bashio::config 'rendering_screen_height') -RENDERING_SCREEN_WIDTH=$(bashio::config 'rendering_screen_width') -GRAYSCALE_DEPTH=$(bashio::config 'grayscale_depth') -LANGUAGE=$(bashio::config 'language') -ROTATION=$(bashio::config 'rotation') -SCALING=$(bashio::config 'scaling') +bashio::log.debug "$(bashio::api.supervisor GET '/core/api/discovery_info' true)" -exec cd /app && /usr/bin/npm start \ No newline at end of file +export HA_BASE_URL="$(bashio::jq "$(bashio::api.supervisor GET '/core/api/discovery_info' true)" ".base_url")" +export HA_ACCESS_TOKEN="$(bashio::config 'ha_token')" +export HA_SCREENSHOT_URL=$(bashio::config 'screenshot_path') +export CRON_JOB=$(bashio::config 'cron_job') +export RENDERING_TIMEOUT=$(bashio::config 'rendering_timeout') +export RENDERING_DELAY=$(bashio::config 'rendering_delay') +export RENDERING_SCREEN_HEIGHT=$(bashio::config 'rendering_screen_height') +export RENDERING_SCREEN_WIDTH=$(bashio::config 'rendering_screen_width') +export GRAYSCALE_DEPTH=$(bashio::config 'grayscale_depth') +export LANGUAGE=$(bashio::config 'language') +export ROTATION=$(bashio::config 'rotation') +export SCALING=$(bashio::config 'debug') + +bashio::log.info "Using base_url: ${HA_BASE_URL}" + +cd /app +exec /usr/bin/npm start \ No newline at end of file