Skip to content

Commit 84c5ae1

Browse files
authored
General updates (#23)
* General updates * space * Update .github/workflows/release-drafter.yaml
1 parent e636745 commit 84c5ae1

File tree

19 files changed

+348
-159
lines changed

19 files changed

+348
-159
lines changed

.devcontainer.json

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,52 @@
1-
{
2-
"name": "custom-components/readme",
3-
"image": "mcr.microsoft.com/devcontainers/python:3.12",
4-
"postCreateCommand": "scripts/setup",
5-
"forwardPorts": [
6-
8123
7-
],
8-
"portsAttributes": {
9-
"8123": {
10-
"label": "Home Assistant",
11-
"onAutoForward": "notify"
12-
}
13-
},
14-
"customizations": {
15-
"vscode": {
16-
"extensions": [
17-
"ms-python.python"
18-
],
19-
"settings": {
20-
"files.eol": "\n",
21-
"editor.tabSize": 4,
22-
"editor.formatOnPaste": true,
23-
"editor.formatOnSave": true,
24-
"editor.formatOnType": false,
25-
"files.trimTrailingWhitespace": true,
26-
"python.formatting.provider": "black",
27-
"python.analysis.typeCheckingMode": "basic",
28-
"python.analysis.autoImportCompletions": true,
29-
"python.defaultInterpreterPath": "/usr/local/bin/python"
30-
}
31-
}
32-
},
33-
"remoteUser": "vscode",
34-
"features": {}
1+
{
2+
"name": "custom-components/readme",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.13",
4+
"postCreateCommand": "scripts/setup",
5+
"forwardPorts": [
6+
8123
7+
],
8+
"portsAttributes": {
9+
"8123": {
10+
"label": "Home Assistant",
11+
"onAutoForward": "notify"
12+
}
13+
},
14+
"customizations": {
15+
"vscode": {
16+
"extensions": [
17+
"charliermarsh.ruff",
18+
"github.vscode-pull-request-github",
19+
"ms-python.python",
20+
"ms-python.vscode-pylance",
21+
"ryanluker.vscode-coverage-gutters"
22+
],
23+
"settings": {
24+
"files.eol": "\n",
25+
"editor.tabSize": 4,
26+
"editor.formatOnPaste": true,
27+
"editor.formatOnSave": true,
28+
"editor.formatOnType": false,
29+
"files.trimTrailingWhitespace": true,
30+
"python.analysis.typeCheckingMode": "basic",
31+
"python.analysis.autoImportCompletions": true,
32+
"python.defaultInterpreterPath": "/usr/local/bin/python",
33+
"[python]": {
34+
"editor.defaultFormatter": "charliermarsh.ruff"
35+
}
36+
}
37+
}
38+
},
39+
"remoteUser": "vscode",
40+
"features": {
41+
"ghcr.io/devcontainers/features/python:1": {
42+
"version": "3.13.2"
43+
},
44+
"ghcr.io/devcontainers-extra/features/apt-packages:1": {
45+
"packages": [
46+
"ffmpeg",
47+
"libturbojpeg0",
48+
"libpcap-dev"
49+
]
50+
}
51+
}
3552
}

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false

.github/dependabot.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2+
version: 2
3+
updates:
4+
- package-ecosystem: "devcontainers"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"
13+
14+
- package-ecosystem: "pip"
15+
directory: "/"
16+
schedule:
17+
interval: "daily"
18+
ignore:
19+
# Dependabot should not update Home Assistant as that should match the homeassistant key in hacs.json
20+
- dependency-name: "homeassistant"

.github/release-drafter.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
change-template: "- #$NUMBER $TITLE @$AUTHOR"
2+
sort-direction: ascending
3+
include-labels:
4+
- "beta"
5+
- "breaking-change"
6+
- "bugfix"
7+
- "dependencies"
8+
- "enhancement"
9+
- "feature"
10+
- "refactor"
11+
categories:
12+
- title: "💥 Breaking changes"
13+
label: "breaking-change"
14+
15+
- title: "🚧 Beta changes"
16+
label: "beta"
17+
collapse-after: 1
18+
19+
- title: "✨ New features"
20+
label: "feature"
21+
22+
- title: "🚀 Performance"
23+
label: "enhancement"
24+
25+
- title: "🔨 Refactor"
26+
label: "refactor"
27+
28+
- title: "🐛 Bug fixes"
29+
label: "bugfix"
30+
31+
- title: "⬆️ Dependency updates"
32+
label: "dependencies"
33+
collapse-after: 1
34+
35+
template: |
36+
$CHANGES
37+
38+
***
39+
If you are using this integration, please consider enabling [Home Assistant usage analytics](https://www.home-assistant.io/integrations/analytics/#usage-analytics).

.github/workflows/lint.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
branches:
9+
- "main"
10+
11+
permissions: {}
12+
13+
jobs:
14+
ruff:
15+
name: "Ruff"
16+
runs-on: "ubuntu-latest"
17+
steps:
18+
- name: Checkout the repository
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
23+
with:
24+
python-version: "3.13"
25+
cache: "pip"
26+
27+
- name: Install requirements
28+
run: python3 -m pip install -r requirements.txt
29+
30+
- name: Lint
31+
run: python3 -m ruff check .
32+
33+
- name: Format
34+
run: python3 -m ruff format . --check
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release-drafter:
10+
name: Release Drafter
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout the repository
14+
uses: actions/[email protected]
15+
16+
- name: Get next version
17+
id: version
18+
run: |
19+
echo "version=$(jq .version -r ./custom_components/readme/manifest.json)" >> $GITHUB_OUTPUT
20+
21+
- name: Run Release Drafter
22+
uses: release-drafter/[email protected]
23+
with:
24+
tag: ${{ steps.version.outputs.version }}
25+
name: ${{ steps.version.outputs.version }}
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,55 @@
1-
name: Release Workflow
1+
name: Publish
22

33
on:
44
release:
55
types:
66
- published
7+
push:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: publish-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions: {}
716

817
jobs:
9-
release:
10-
name: Release
18+
release_zip_file:
19+
name: Publish readme zip file asset
1120
runs-on: ubuntu-latest
21+
permissions:
22+
contents: write
1223
steps:
1324
- name: 📥 Checkout the repository
14-
uses: actions/checkout@v2
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1526

16-
- name: 🔢 Get release version
17-
id: version
18-
uses: home-assistant/actions/helpers/version@master
27+
- name: 🛠️ Set up Python
28+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
29+
with:
30+
python-version: "3.13"
1931

20-
- name: ℹ️ Get integration information
21-
id: information
22-
run: |
23-
name=$(find custom_components/ -type d -maxdepth 1 | tail -n 1 | cut -d "/" -f2)
24-
echo "::set-output name=name::$name"
32+
- name: 🔢 Get version
33+
if: ${{ github.event_name == 'release' }}
34+
id: version
35+
uses: home-assistant/actions/helpers/version@a19f5f4e08ef2786e4604a948f62addd937a6bc9 # master
2536

26-
- name: 🖊️ Set version number
37+
# Pack the readme dir as a zip and upload to the release
38+
- name: 📦 ZIP readme dir
2739
run: |
28-
sed -i '/INTEGRATION_VERSION = /c\INTEGRATION_VERSION = "${{ steps.version.outputs.version }}"' \
29-
"${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/const.py"
30-
jq '.version = "${{ steps.version.outputs.version }}"' \
31-
"${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/manifest.json" > tmp \
32-
&& mv -f tmp "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/manifest.json"
40+
cd ${{ github.workspace }}/custom_components/readme
41+
zip readme.zip -r ./
3342
34-
- name: 👀 Validate data
35-
run: |
36-
if ! grep -q 'INTEGRATION_VERSION = "${{ steps.version.outputs.version }}"' ${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/const.py; then
37-
echo "The version in custom_components/${{ steps.information.outputs.name }}/const.py was not correct"
38-
cat ${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/const.py | grep INTEGRATION_VERSION
39-
exit 1
40-
fi
41-
manifestversion=$(jq -r '.version' ${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/manifest.json)
42-
if [ "$manifestversion" != "${{ steps.version.outputs.version }}" ]; then
43-
echo "The version in custom_components/${{ steps.information.outputs.name }}/manifest.json was not correct"
44-
echo "$manifestversion"
45-
exit 1
46-
fi
47-
48-
- name: 📦 Create zip file for the integration
49-
run: |
50-
cd "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}"
51-
zip ${{ steps.information.outputs.name }}.zip -r ./
43+
- name: 📤 Upload zip to action
44+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
45+
if: ${{ github.event_name == 'push' }}
46+
with:
47+
name: readme.zip
48+
path: ${{ github.workspace }}/custom_components/readme/readme.zip
49+
retention-days: 7
5250

53-
- name: 📤 Upload the zip file as a release asset
54-
uses: actions/upload-release-asset@v1
55-
env:
56-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
- name: 📤 Upload zip to release
52+
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
53+
if: ${{ github.event_name == 'release' }}
5754
with:
58-
upload_url: ${{ github.event.release.upload_url }}
59-
asset_path: "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/${{ steps.information.outputs.name }}.zip"
60-
asset_name: ${{ steps.information.outputs.name }}.zip
61-
asset_content_type: application/zip
55+
files: ${{ github.workspace }}/custom_components/readme/readme.zip

.github/workflows/validate.yaml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
11
name: Validate
22

3-
43
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * *"
57
push:
68
branches:
79
- main
810
pull_request:
911
branches:
1012
- main
11-
schedule:
12-
- cron: "0 0 * * *"
13+
14+
permissions: {}
1315

1416
jobs:
15-
validate-hassfest:
17+
hassfest: # https://developers.home-assistant.io/blog/2020/04/16/hassfest
18+
name: Hassfest validation
1619
runs-on: ubuntu-latest
17-
name: With hassfest
1820
steps:
19-
- name: Check out repository
20-
uses: actions/checkout@v2
21+
- name: Checkout the repository
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2123

22-
- name: Hassfest validation
23-
uses: "home-assistant/actions/hassfest@master"
24+
- name: Run hassfest validation
25+
uses: home-assistant/actions/hassfest@a19f5f4e08ef2786e4604a948f62addd937a6bc9 # master
2426

25-
validate-hacs:
27+
hacs: # https://github.com/hacs/action
28+
name: HACS validation
2629
runs-on: ubuntu-latest
27-
name: With HACS Action
2830
steps:
29-
- name: Check out repository
30-
uses: actions/checkout@v2
31-
32-
- name: HACS validation
33-
uses: hacs/action@main
34-
with:
35-
category: integration
36-
comment: false
37-
ignore: brands
31+
- name: Run HACS validation
32+
uses: hacs/action@d556e736723344f83838d08488c983a15381059a # 22.5.0
33+
with:
34+
category: integration
35+
ignore: brands

0 commit comments

Comments
 (0)