Skip to content

Commit

Permalink
Merge pull request #1 from marciogranzotto/hassio-addon
Browse files Browse the repository at this point in the history
Hassio addon
  • Loading branch information
marciogranzotto authored Apr 9, 2021
2 parents c4f05fa + d874558 commit b686519
Show file tree
Hide file tree
Showing 19 changed files with 408 additions and 85 deletions.
20 changes: 20 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

# Update the VARIANT arg in devcontainer.json to pick an Ubuntu version: focal (or ubuntu-20.04), bionic (or ubuntu-18.04)
# To fully customize the contents of this image, use the following Dockerfile instead:
# https://github.com/microsoft/vscode-dev-containers/tree/v0.128.0/containers/ubuntu/.devcontainer/base.Dockerfile
ARG VARIANT="focal"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}

# ** [Optional] Uncomment this section to install additional packages. **
#
# RUN apt-get update \
# && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

ARG HADOLINT_VERSION=v1.17.6
RUN wget -O /usr/local/bin/hadolint https://github.com/hadolint/hadolint/releases/download/${HADOLINT_VERSION}/hadolint-Linux-x86_64 \
&& chmod +x /usr/local/bin/hadolint
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.128.0/containers/ubuntu
{
"name": "Ubuntu",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Ubuntu version. Rebuild the container if it already
// exists to update. Available variants: focal (or ubuntu-20.04), bionic (or ubuntu-18.04)
"args": { "VARIANT": "focal" }
},

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"exiasr.hadolint",
"omartawfik.github-actions-vscode"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "git config --global core.autocrlf true"

// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],

// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
}
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
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
57 changes: 57 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Test Docker build

on: [pull_request]

jobs:
dockerlint:
name: Dockerfile linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: hadolint
run: docker run --rm -i hadolint/hadolint < lovelace-kindle-screensaver/Dockerfile
build-amd64:
name: Build amd64 image
runs-on: ubuntu-latest
needs: [dockerlint]
steps:
- uses: actions/checkout@v2
- name: Patch files
uses: onlyutkarsh/[email protected]
with:
files: |
lovelace-kindle-screensaver/config.json
patch-syntax: |
= /version => "${{ github.run_number }}"
- name: build amd64 image
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 --test
build-armv7:
name: Build armv7 image
runs-on: ubuntu-latest
needs: [dockerlint]
steps:
- uses: actions/checkout@v2
- name: Patch files
uses: onlyutkarsh/[email protected]
with:
files: |
lovelace-kindle-screensaver/config.json
patch-syntax: |
= /version => "${{ github.run_number }}"
- name: build armv7 image
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 --test
build-aarch64:
name: Build aarch64 image
runs-on: ubuntu-latest
needs: [dockerlint]
steps:
- uses: actions/checkout@v2
- name: Patch files
uses: onlyutkarsh/[email protected]
with:
files: |
lovelace-kindle-screensaver/config.json
patch-syntax: |
= /version => "${{ github.run_number }}"
- name: build aarch64 image
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 --test
64 changes: 64 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
rules:
braces:
level: error
min-spaces-inside: 0
max-spaces-inside: 1
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
brackets:
level: error
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
colons:
level: error
max-spaces-before: 0
max-spaces-after: 1
commas:
level: error
max-spaces-before: 0
min-spaces-after: 1
max-spaces-after: 1
comments:
level: error
require-starting-space: true
min-spaces-from-content: 2
comments-indentation:
level: error
document-end:
level: error
present: false
document-start:
level: error
present: true
empty-lines:
level: error
max: 1
max-start: 0
max-end: 1
hyphens:
level: error
max-spaces-after: 1
indentation:
level: error
spaces: 2
indent-sequences: true
check-multi-line-strings: false
key-duplicates:
level: error
line-length:
level: warning
max: 120
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
new-line-at-end-of-file:
level: error
new-lines:
level: error
type: unix
trailing-spaces:
level: error
truthy:
level: error
27 changes: 0 additions & 27 deletions Dockerfile

This file was deleted.

23 changes: 0 additions & 23 deletions docker-compose.yml

This file was deleted.

Loading

0 comments on commit b686519

Please sign in to comment.