Skip to content

Commit

Permalink
Fix add-on
Browse files Browse the repository at this point in the history
  • Loading branch information
marciogranzotto committed Apr 9, 2021
1 parent 48c0799 commit d874558
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 59 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/ci.yml

This file was deleted.

74 changes: 74 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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/[email protected]
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
12 changes: 6 additions & 6 deletions lovelace-kindle-screensaver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -44,12 +44,12 @@ LABEL \
io.hass.type="addon" \
io.hass.version=${BUILD_VERSION} \
maintainer="Marcio Granzotto <[email protected]>" \
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 <[email protected]>" \
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}
15 changes: 10 additions & 5 deletions lovelace-kindle-screensaver/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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,
Expand All @@ -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",
Expand All @@ -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}",
Expand Down
31 changes: 18 additions & 13 deletions lovelace-kindle-screensaver/rootfs/etc/services.d/node/run
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
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

0 comments on commit d874558

Please sign in to comment.