Skip to content

Commit

Permalink
Update project so it works on current versions of Home Assistant (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ceskyDJ authored Jan 2, 2025
2 parents cf1a253 + 3ff999a commit 180b8f2
Show file tree
Hide file tree
Showing 13 changed files with 229 additions and 379 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Configuration file for GitHub Dependabot

version: 2

updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
assignees:
- "ceskyDJ"
33 changes: 33 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: deploy

on:
workflow_dispatch:
push:
tags: ['v*']

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
name: Build and deploy add-on
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build add-on and publish it to GitHub Container Registry
uses: home-assistant/[email protected]
with:
args: |
--all \
--target . \
--docker-hub "ghcr.io/${{ github.repository_owner }}"
27 changes: 4 additions & 23 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,16 @@ on:
pull_request:
branches:
- master
schedule:
- cron: "0 0 * * *"

jobs:
find:
name: Find add-ons
runs-on: ubuntu-latest
outputs:
addons: ${{ steps.addons.outputs.addons_list }}
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]

- name: 🔍 Find add-on directories
id: addons
uses: home-assistant/actions/helpers/find-addons@master

lint:
name: Lint add-on ${{ matrix.path }}
name: Lint add-on config file
runs-on: ubuntu-latest
needs: find
strategy:
matrix:
path: ${{ fromJson(needs.find.outputs.addons) }}
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4

- name: 🚀 Run Home Assistant Add-on Lint
uses: frenck/action-addon-linter@v2.11
uses: frenck/action-addon-linter@v2.18.0
with:
path: "./${{ matrix.path }}"
path: "."
127 changes: 0 additions & 127 deletions .github/workflows/main.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# IDE files
.idea/
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
ARG BUILD_FROM
FROM $BUILD_FROM

ENV LANG C.UTF-8
ENV LANG=C.UTF-8

RUN apk add --no-cache \
borgbackup \
openssh-keygen \
openssh-client
openssh-client \
tar

# Home Assistant CLI
ARG BUILD_ARCH
ARG CLI_VERSION
RUN curl -Lso /usr/bin/ha \
"https://github.com/home-assistant/cli/releases/download/${CLI_VERSION}/ha_${BUILD_ARCH}" \
&& chmod a+x /usr/bin/ha
RUN curl -Lso /usr/bin/ha "https://github.com/home-assistant/cli/releases/latest/download/ha_${BUILD_ARCH}"
RUN chmod +x /usr/bin/ha

# Copy required data for add-on
COPY run.sh /
RUN chmod a+x /run.sh
RUN chmod +x /run.sh

CMD [ "/run.sh" ]
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
SHELL=/bin/bash

.PHONY: build run dev-deploy

build:
docker run \
--rm \
-it \
--name builder \
--privileged \
-v .:/data \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
ghcr.io/home-assistant/amd64-builder \
-t /data \
--all \
--test \
-i home-assistant-borg-backup-dev \
-d local

run: build
docker run --rm -v ./data:/data local/home-assistant-borg-backup-dev

dev-deploy:
scp -r ../home-assistant-borg-backup steve:/addons
Loading

0 comments on commit 180b8f2

Please sign in to comment.