Initial version

This commit is contained in:
Thomas Bétrancourt
2024-10-18 12:10:41 +00:00
parent 67d0375f99
commit df600eb18e
30 changed files with 1373 additions and 0 deletions

32
.github/workflows/lint.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
name: "Lint"
on:
push:
branches:
- "**"
pull_request:
branches:
- master"
jobs:
ruff:
name: "Ruff"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.7"
- name: "Set up Python"
uses: actions/setup-python@v5.2.0
with:
python-version: "3.12"
cache: "pip"
- name: "Install requirements"
run: python3 -m pip install -r requirements.txt
- name: "Lint"
run: python3 -m ruff check .
- name: "Format"
run: python3 -m ruff format . --check

54
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,54 @@
name: "Release"
on:
push:
branches:
- master
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
release:
name: "Release"
runs-on: "ubuntu-latest"
permissions:
contents: write
id-token: write
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.7"
with:
fetch-depth: ${{ !startsWith(github.ref, 'refs/tags/v') && 20 || 1 }}
fetch-tags: ${{ !startsWith(github.ref, 'refs/tags/v') }}
- name: Get current version
id: version
run: |
version=$(git describe --tag --match 'v*.*.*' 2>/dev/null || true)
if [ -z "${version}" ]; then
commit_count=$(git rev-list --all --count)
version="0.0.0-${commit_count}-$(git rev-parse --short HEAD)"
fi
echo "version=$version" >> ${GITHUB_ENV}
- name: "ZIP the integration directory"
shell: "bash"
run: |
set -x
cd "${{ github.workspace }}/custom_components/ecocito"
jq --arg version ${version} '.version = $version' manifest.json > manifest.tmp.json && mv manifest.tmp.json manifest.json
zip ecocito-${version}.zip -r ./
- name: Publish the release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ !startsWith(github.ref, 'refs/tags/v') && 'latest' || null }}
prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }}
title: ${{ startsWith(github.ref, 'refs/tags/v') && env.version || 'Development Build' }}
files: |
${{ github.workspace }}/custom_components/ecocito/ecocito-${{ env.version }}.zip

37
.github/workflows/validate.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: "Validate"
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches:
- "master"
pull_request:
branches:
- "master"
jobs:
hassfest: # https://developers.home-assistant.io/blog/2020/04/16/hassfest
name: "Hassfest Validation"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.7"
- name: "Run hassfest validation"
uses: "home-assistant/actions/hassfest@master"
hacs: # https://github.com/hacs/action
name: "HACS Validation"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.7"
- name: "Run HACS validation"
uses: "hacs/action@main"
with:
category: "integration"
# Remove this 'ignore' key when you have added brand images for your integration to https://github.com/home-assistant/brands
ignore: "brands"