Add more boilerplate (#10)

This commit is contained in:
Joakim Sørensen
2021-09-26 18:28:49 +02:00
committed by GitHub
parent 9a921b3d70
commit 8b111e9eed
7 changed files with 42 additions and 6 deletions

View File

@@ -81,7 +81,7 @@ jobs:
run: | run: |
if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
echo "::set-output name=build_arch::true"; echo "::set-output name=build_arch::true";
echo "::set-output name=image::$(echo '${{ steps.info.outputs.image }}' | cut -d'/' -f3)"; echo "::set-output name=image::$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)";
if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then
echo "BUILD_ARGS=" >> $GITHUB_ENV; echo "BUILD_ARGS=" >> $GITHUB_ENV;
fi fi

View File

@@ -1,4 +1,11 @@
<!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog --> <!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog -->
## 1.1.0
- Add configuration options
- Add labels to the docker image
- Install tempio in the docker image to show how args can be used
## 1.0.1 ## 1.0.1
- Use yaml for config and build files - Use yaml for config and build files
@@ -9,4 +16,4 @@
## 0.1.0 ## 0.1.0
- Initial release - Initial release

View File

@@ -2,5 +2,11 @@
ARG BUILD_FROM ARG BUILD_FROM
FROM $BUILD_FROM FROM $BUILD_FROM
# Execute during the build of the image
ARG TEMPIO_VERSION BUILD_ARCH
RUN \
curl -sSLf -o /usr/bin/tempio \
"https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}"
# Copy data # Copy data
COPY rootfs / COPY rootfs /

View File

@@ -5,3 +5,10 @@ build_from:
armhf: "ghcr.io/home-assistant/armhf-base:3.14" armhf: "ghcr.io/home-assistant/armhf-base:3.14"
armv7: "ghcr.io/home-assistant/armv7-base:3.14" armv7: "ghcr.io/home-assistant/armv7-base:3.14"
i386: "ghcr.io/home-assistant/i386-base:3.14" i386: "ghcr.io/home-assistant/i386-base:3.14"
labels:
org.opencontainers.image.title: "Home Assistant Add-on: Example add-on"
org.opencontainers.image.description: "Example add-on to use as a blueprint for new add-ons."
org.opencontainers.image.source: "https://github.com/home-assistant/addons-example"
org.opencontainers.image.licenses: "Apache License 2.0"
args:
TEMPIO_VERSION: "2021.05.0"

View File

@@ -1,6 +1,6 @@
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
name: Example add-on name: Example add-on
version: "1.0.1" version: "1.1.0"
slug: example slug: example
description: Example add-on description: Example add-on
url: "https://github.com/home-assistant/addons-example/tree/master/example" url: "https://github.com/home-assistant/addons-example/tree/master/example"
@@ -11,4 +11,8 @@ arch:
- amd64 - amd64
- i386 - i386
startup: once startup: once
options:
message: "Hello world..."
schema:
message: "str?"
image: "ghcr.io/home-assistant/{arch}-addon-example" image: "ghcr.io/home-assistant/{arch}-addon-example"

View File

@@ -3,8 +3,16 @@
# Start the example service # Start the example service
# ============================================================================== # ==============================================================================
## Add your code here # Add your code here
bashio::log.info "Hello world" ## Get the 'message' key from the user config options.
CONFIG_MESSAGE=$(bashio::config 'message')
## Set the message to be printed, defaults to "Hello World..."
PRINT_MESSAGE=${CONFIG_MESSAGE:="Hello World..."}
## Print the message the user supplied
bashio::log.info "${PRINT_MESSAGE}"
## Run your program
# exec my_program --with-params # exec my_program --with-params

View File

@@ -0,0 +1,4 @@
configuration:
message:
name: Message
description: The message that will be printed to the log when starting this example add-on.