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:
|
||||
BUILD_ARGS: "--test"
|
||||
MONITORED_FILES: "build.json config.json Dockerfile rootfs"
|
||||
MONITORED_FILES: "build.yaml config.yaml Dockerfile rootfs"
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -17,7 +17,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
name: Initialize builds
|
||||
outputs:
|
||||
changed_files: ${{ steps.changed_files.outputs.all }}
|
||||
changed_addons: ${{ steps.changed_addons.outputs.addons }}
|
||||
changed: ${{ steps.changed_addons.outputs.changed }}
|
||||
steps:
|
||||
@@ -28,14 +27,10 @@ jobs:
|
||||
id: changed_files
|
||||
uses: jitterbit/get-changed-files@v1
|
||||
|
||||
- name: Get add-ons
|
||||
- name: Find add-on directories
|
||||
id: addons
|
||||
run: |
|
||||
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[@]}"
|
||||
uses: home-assistant/actions/helpers/find-addons@master
|
||||
|
||||
- name: Get changed add-ons
|
||||
id: changed_addons
|
||||
run: |
|
||||
@@ -51,7 +46,9 @@ jobs:
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
changed=$(echo ${changed_addons[@]} | rev | cut -c 2- | rev)
|
||||
|
||||
if [[ -n ${changed} ]]; then
|
||||
echo "Changed add-ons: $changed";
|
||||
echo "::set-output name=changed::true";
|
||||
@@ -79,23 +76,18 @@ jobs:
|
||||
with:
|
||||
path: "./${{ matrix.addon }}"
|
||||
|
||||
- name: Check add-on
|
||||
- name: Check if add-on should be built
|
||||
id: check
|
||||
run: |
|
||||
if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
|
||||
echo "::set-output name=build_arch::true";
|
||||
if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then
|
||||
echo "BUILD_ARGS=" >> $GITHUB_ENV;
|
||||
fi
|
||||
else
|
||||
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
|
||||
echo "::set-output name=build_arch::false";
|
||||
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
|
||||
if: env.BUILD_ARGS != '--test'
|
||||
@@ -113,6 +105,6 @@ jobs:
|
||||
${{ env.BUILD_ARGS }} \
|
||||
--${{ matrix.arch }} \
|
||||
--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 }}" \
|
||||
--addon
|
||||
|
||||
10
.github/workflows/lint.yaml
vendored
10
.github/workflows/lint.yaml
vendored
@@ -22,15 +22,7 @@ jobs:
|
||||
|
||||
- name: 🔍 Find add-on directories
|
||||
id: addons
|
||||
run: |
|
||||
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}]"
|
||||
|
||||
uses: home-assistant/actions/helpers/find-addons@master
|
||||
|
||||
lint:
|
||||
name: Lint add-on ${{ matrix.path }}
|
||||
|
||||
Reference in New Issue
Block a user