Test using the CI
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
# stolen from zigbee2mqtt
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
type:
|
||||
description: 'Type (edge)'
|
||||
default: 'edge'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
variables:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
ARCH_LIST: ${{ env.ARCH_LIST }}
|
||||
ADDON_LIST: ${{ env.ADDON_LIST }}
|
||||
DOCKER_ARGS: ${{ env.DOCKER_ARGS }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: "ARGS: default"
|
||||
run: |
|
||||
echo "ADDON_LIST=['grott', 'grott-current']" >> $GITHUB_ENV
|
||||
echo "DOCKER_ARGS=--no-latest --test" >> $GITHUB_ENV
|
||||
- name: "ARGS: grott-edge" # Build of addon edge version
|
||||
if: github.ref == 'refs/heads/master' && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'edge'))
|
||||
run: |
|
||||
echo "ADDON_LIST=['grott-edge']" >> $GITHUB_ENV
|
||||
echo "DOCKER_ARGS=--no-cache" >> $GITHUB_ENV
|
||||
- name: "ARGS: grott" # Build of addon release version
|
||||
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
|
||||
run: |
|
||||
echo "ADDON_LIST=['grott']" >> $GITHUB_ENV
|
||||
echo "DOCKER_ARGS=--no-cache --docker-hub-check" >> $GITHUB_ENV
|
||||
- name: Determine arch
|
||||
id: determine_arch
|
||||
run: |
|
||||
ARCH_LIST=$(jq -r -c '.arch' ./${{ fromJSON(env.ADDON_LIST)[0] }}/config.json)
|
||||
echo "Found the following arches: $ARCH_LIST"
|
||||
echo "ARCH_LIST=$ARCH_LIST" >> $GITHUB_ENV
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: variables
|
||||
env:
|
||||
DOCKER_ARGS: ${{needs.variables.outputs.DOCKER_ARGS}}
|
||||
strategy:
|
||||
matrix:
|
||||
arch: ${{fromJSON(needs.variables.outputs.ARCH_LIST)}}
|
||||
addon: ${{fromJSON(needs.variables.outputs.ADDON_LIST)}}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Docker login
|
||||
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
|
||||
run: echo ${{ secrets.DOCKER_SECRET }} | docker login -u egguy --password-stdin
|
||||
- name: Build
|
||||
run: |
|
||||
cp ${{ matrix.addon }}/build.yaml ${{ matrix.addon }}
|
||||
docker run --rm --privileged \
|
||||
-v /home/runner/.docker:/root/.docker \
|
||||
-v /run/docker.sock:/run/docker.sock:rw \
|
||||
-v $(pwd)/${{ matrix.addon }}:/data homeassistant/amd64-builder --${{ matrix.arch }} -t /data \
|
||||
${{ env.DOCKER_ARGS }}
|
||||
@@ -1,23 +0,0 @@
|
||||
name: "Build edge"
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Publish
|
||||
uses: home-assistant/builder@master
|
||||
with:
|
||||
args: |
|
||||
--all \
|
||||
--target grott-current \
|
||||
--docker-hub ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
Reference in New Issue
Block a user