Use yaml files (#9)
This commit is contained in:
32
.github/workflows/builder.yaml
vendored
32
.github/workflows/builder.yaml
vendored
@@ -2,7 +2,7 @@ name: Builder
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
BUILD_ARGS: "--test"
|
BUILD_ARGS: "--test"
|
||||||
MONITORED_FILES: "build.json config.json Dockerfile rootfs"
|
MONITORED_FILES: "build.yaml config.yaml Dockerfile rootfs"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -17,7 +17,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Initialize builds
|
name: Initialize builds
|
||||||
outputs:
|
outputs:
|
||||||
changed_files: ${{ steps.changed_files.outputs.all }}
|
|
||||||
changed_addons: ${{ steps.changed_addons.outputs.addons }}
|
changed_addons: ${{ steps.changed_addons.outputs.addons }}
|
||||||
changed: ${{ steps.changed_addons.outputs.changed }}
|
changed: ${{ steps.changed_addons.outputs.changed }}
|
||||||
steps:
|
steps:
|
||||||
@@ -28,14 +27,10 @@ jobs:
|
|||||||
id: changed_files
|
id: changed_files
|
||||||
uses: jitterbit/get-changed-files@v1
|
uses: jitterbit/get-changed-files@v1
|
||||||
|
|
||||||
- name: Get add-ons
|
- name: Find add-on directories
|
||||||
id: addons
|
id: addons
|
||||||
run: |
|
uses: home-assistant/actions/helpers/find-addons@master
|
||||||
declare -a addons
|
|
||||||
for addon in $(find ./ -name config.json | cut -d "/" -f2 | sort -u); do
|
|
||||||
addons+=("$addon");
|
|
||||||
done
|
|
||||||
echo "::set-output name=addons::${addons[@]}"
|
|
||||||
- name: Get changed add-ons
|
- name: Get changed add-ons
|
||||||
id: changed_addons
|
id: changed_addons
|
||||||
run: |
|
run: |
|
||||||
@@ -51,7 +46,9 @@ jobs:
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
changed=$(echo ${changed_addons[@]} | rev | cut -c 2- | rev)
|
changed=$(echo ${changed_addons[@]} | rev | cut -c 2- | rev)
|
||||||
|
|
||||||
if [[ -n ${changed} ]]; then
|
if [[ -n ${changed} ]]; then
|
||||||
echo "Changed add-ons: $changed";
|
echo "Changed add-ons: $changed";
|
||||||
echo "::set-output name=changed::true";
|
echo "::set-output name=changed::true";
|
||||||
@@ -79,23 +76,18 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: "./${{ matrix.addon }}"
|
path: "./${{ matrix.addon }}"
|
||||||
|
|
||||||
- name: Check add-on
|
- name: Check if add-on should be built
|
||||||
id: check
|
id: check
|
||||||
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";
|
||||||
|
if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then
|
||||||
|
echo "BUILD_ARGS=" >> $GITHUB_ENV;
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
|
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
|
||||||
|
echo "::set-output name=build_arch::false";
|
||||||
fi
|
fi
|
||||||
image=$(jq -r '.image' "./${{ matrix.addon }}/config.json" | cut -d"/" -f3)
|
|
||||||
echo "::set-output name=image::${image}";
|
|
||||||
|
|
||||||
- name: Set build arguments
|
|
||||||
if: steps.check.outputs.build_arch == 'true'
|
|
||||||
run: |
|
|
||||||
if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then
|
|
||||||
echo "BUILD_ARGS=" >> $GITHUB_ENV;
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
if: env.BUILD_ARGS != '--test'
|
if: env.BUILD_ARGS != '--test'
|
||||||
@@ -113,6 +105,6 @@ jobs:
|
|||||||
${{ env.BUILD_ARGS }} \
|
${{ env.BUILD_ARGS }} \
|
||||||
--${{ matrix.arch }} \
|
--${{ matrix.arch }} \
|
||||||
--target /data/${{ matrix.addon }} \
|
--target /data/${{ matrix.addon }} \
|
||||||
--image "${{ steps.check.outputs.image }}" \
|
--image "$(echo '${{ steps.info.outputs.image }}' | cut -d'/' -f3)" \
|
||||||
--docker-hub "ghcr.io/${{ github.repository_owner }}" \
|
--docker-hub "ghcr.io/${{ github.repository_owner }}" \
|
||||||
--addon
|
--addon
|
||||||
|
|||||||
10
.github/workflows/lint.yaml
vendored
10
.github/workflows/lint.yaml
vendored
@@ -22,15 +22,7 @@ jobs:
|
|||||||
|
|
||||||
- name: 🔍 Find add-on directories
|
- name: 🔍 Find add-on directories
|
||||||
id: addons
|
id: addons
|
||||||
run: |
|
uses: home-assistant/actions/helpers/find-addons@master
|
||||||
declare -a found_addons
|
|
||||||
for addon in $(find ./ -name config.json | cut -d "/" -f2 | sort -u); do
|
|
||||||
found_addons+=("\"${addon}\",");
|
|
||||||
done
|
|
||||||
addons=$(echo ${found_addons[@]} | rev | cut -c 2- | rev)
|
|
||||||
echo "Add-ons found: ${addons}"
|
|
||||||
echo "::set-output name=addons::[${addons}]"
|
|
||||||
|
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
name: Lint add-on ${{ matrix.path }}
|
name: Lint add-on ${{ matrix.path }}
|
||||||
|
|||||||
@@ -25,16 +25,16 @@ _Example add-on to use as a blueprint for new add-ons._
|
|||||||
<!--
|
<!--
|
||||||
|
|
||||||
Notes to developers after forking or using the github template feature:
|
Notes to developers after forking or using the github template feature:
|
||||||
- While developing remove the 'image' tag from 'example/config.json' to make the supervisor build the addon
|
- While developing comment out the 'image' key from 'example/config.yaml' to make the supervisor build the addon
|
||||||
- Remember to put this back when pushing up your changes.
|
- Remember to put this back when pushing up your changes.
|
||||||
- When you merge to the 'master' branch of your repository a new build will be triggered.
|
- When you merge to the 'master' branch of your repository a new build will be triggered.
|
||||||
- Make sure you adjust the 'version' key in 'example/config.json' when you do that.
|
- Make sure you adjust the 'version' key in 'example/config.yaml' when you do that.
|
||||||
- Make sure you update 'example/CHANGELOG.md' when you do that.
|
- Make sure you update 'example/CHANGELOG.md' when you do that.
|
||||||
- The first time this runs you might need to adjust the image configuration on github container registry to make it public
|
- The first time this runs you might need to adjust the image configuration on github container registry to make it public
|
||||||
- Adjust the 'image' key in 'example/config.json' so it points to your username instead of 'home-assistant'.
|
- Adjust the 'image' key in 'example/config.yaml' so it points to your username instead of 'home-assistant'.
|
||||||
- This is where the build images will be published to.
|
- This is where the build images will be published to.
|
||||||
- Rename the example directory.
|
- Rename the example directory.
|
||||||
- The 'slug' key in 'example/config.json' should match the directory name.
|
- The 'slug' key in 'example/config.yaml' should match the directory name.
|
||||||
- Adjust all keys/url's that points to 'home-assistant' to now point to your user/fork.
|
- Adjust all keys/url's that points to 'home-assistant' to now point to your user/fork.
|
||||||
- Share your repository on the forums https://community.home-assistant.io/c/projects/9
|
- Share your repository on the forums https://community.home-assistant.io/c/projects/9
|
||||||
- Do awesome stuff!
|
- Do awesome stuff!
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
<!-- 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.0.1
|
||||||
|
|
||||||
|
- Use yaml for config and build files
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
||||||
- Complete refresh of all files
|
- Complete refresh of all files
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"build_from": {
|
|
||||||
"aarch64": "ghcr.io/home-assistant/aarch64-base:3.14",
|
|
||||||
"amd64": "ghcr.io/home-assistant/amd64-base:3.14",
|
|
||||||
"armhf": "ghcr.io/home-assistant/armhf-base:3.14",
|
|
||||||
"armv7": "ghcr.io/home-assistant/armv7-base:3.14",
|
|
||||||
"i386": "ghcr.io/home-assistant/i386-base:3.14"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
7
example/build.yaml
Normal file
7
example/build.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile
|
||||||
|
build_from:
|
||||||
|
aarch64: "ghcr.io/home-assistant/aarch64-base:3.14"
|
||||||
|
amd64: "ghcr.io/home-assistant/amd64-base:3.14"
|
||||||
|
armhf: "ghcr.io/home-assistant/armhf-base:3.14"
|
||||||
|
armv7: "ghcr.io/home-assistant/armv7-base:3.14"
|
||||||
|
i386: "ghcr.io/home-assistant/i386-base:3.14"
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Example add-on",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"slug": "example",
|
|
||||||
"description": "Example add-on",
|
|
||||||
"url": "https://github.com/home-assistant/addons-example/tree/master/example",
|
|
||||||
"arch": [
|
|
||||||
"armhf",
|
|
||||||
"armv7",
|
|
||||||
"aarch64",
|
|
||||||
"amd64",
|
|
||||||
"i386"
|
|
||||||
],
|
|
||||||
"startup": "once",
|
|
||||||
"image": "ghcr.io/home-assistant/{arch}-addon-example"
|
|
||||||
}
|
|
||||||
14
example/config.yaml
Normal file
14
example/config.yaml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
|
||||||
|
name: Example add-on
|
||||||
|
version: "1.0.1"
|
||||||
|
slug: example
|
||||||
|
description: Example add-on
|
||||||
|
url: "https://github.com/home-assistant/addons-example/tree/master/example"
|
||||||
|
arch:
|
||||||
|
- armhf
|
||||||
|
- armv7
|
||||||
|
- aarch64
|
||||||
|
- amd64
|
||||||
|
- i386
|
||||||
|
startup: once
|
||||||
|
image: "ghcr.io/home-assistant/{arch}-addon-example"
|
||||||
Reference in New Issue
Block a user