Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update, refactor and restructure repo #1

Merged
merged 31 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions .devcontainer/Dockerfile

This file was deleted.

56 changes: 29 additions & 27 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json
// TODO: When https://github.com/microsoft/vscode-remote-release/issues/2129 is fixed, move to ${localWorkspaceFolderBasename}\
{
"name": "Home Assistant Add-On",
"context": "..",
"dockerFile": "Dockerfile",
"appPort": 8123,
"runArgs": [
"-e",
"GIT_EDITOR=code --wait",
"--privileged"
],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/test_hassio/addons/local/myaddon,type=bind,consistency=delegated",
"workspaceFolder": "/workspaces/test_hassio/addons/local/myaddon",
"mounts": [
// Cache docker images between devcontainer rebuilds (and share between devcontainers)
"source=vsc-hassio-docker,target=/var/lib/docker,type=volume"
]

// Post-create command to initialize the workspace. For example, for a node.js add-on you may want:
// "postCreateCommand": "cd /workspaces/test_hassio/addons/local/myaddon && npm install",
// "extensions": [
// "dbaeumer.vscode-eslint",
// "maty.vscode-mocha-sidebar"
// ]
"name": "HA Addon: TeslaMate",
"image": "ghcr.io/home-assistant/devcontainer:addons",
"appPort": ["7123:8123", "7357:4357"],
"postStartCommand": "sudo sed -i 's/export SUPERVISOR_VERSION=.*/export SUPERVISOR_VERSION=2024.03.1.dev1803/' /etc/supervisor_scripts/common && bash devcontainer_bootstrap", // Workaround until https://github.com/home-assistant/supervisor/issues/5021 is fixed"
"runArgs": ["-e", "GIT_EDITOR=code --wait", "--privileged"],
"containerEnv": {
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
},
"customizations": {
"vscode": {
"extensions": [
"timonwong.shellcheck",
"esbenp.prettier-vscode"
],
"settings": {
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
}
},
"mounts": ["type=volume,target=/var/lib/docker"]
}
103 changes: 0 additions & 103 deletions .devcontainer/start_ha.sh

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.md

This file was deleted.

12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md

This file was deleted.

8 changes: 0 additions & 8 deletions .github/dependabot.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
":disableDependencyDashboard"
],
"prHourlyLimit": 4,
"prBodyTemplate": "{{{table}}}{{{warnings}}}{{{notes}}}{{{changelogs}}}",
"semanticCommits": "disabled",
"commitMessageTopic": "{{#if (containsString depName 'teslamate')}}TeslaMate{{else}}{{depName}}{{/if}}",
"customManagers": [
{
"customType": "regex",
"fileMatch": "^build\\.json$",
"matchStrings": [
"\"teslamate_version\": \"(?<currentValue>\\d+\\.\\d+\\.\\d+)\""
],
"datasourceTemplate": "github-releases",
"depNameTemplate": "teslamate-org/teslamate"
}
],
"prBodyColumns": [
"Package",
"Update",
"Change"
]
}
32 changes: 32 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
name: Lint add-on
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]

- name: 🚀 Run Home Assistant Add-on Lint
uses: frenck/action-addon-linter@v2
with:
path: "./"

- name: Check versions match
run: |
docker_ver=$(grep "FROM teslamate/teslamate" Dockerfile | cut -d':' -f2)
build_ver=$(jq -r ".args.teslamate_version" build.json)
if [ "$docker_ver" != "$build_ver" ]; then
echo -e "\033[31;1mTeslaMate versions don't match: Dockerfile => ${docker_ver} | build.json => ${build_ver}\033[0m"
exit 1
fi
echo -e "\033[32;1mTeslaMate versions match: Dockerfile => ${docker_ver} | build.json => ${build_ver}\033[0m"
51 changes: 51 additions & 0 deletions .github/workflows/publisher.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Publish"

on:
release:
types: [published]
workflow_dispatch:
workflow_call:
inputs:
version:
required: false
type: string

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
arch: ["amd64", "armv7", "aarch64"]

steps:
- name: Checkout the repository
uses: actions/[email protected]

- name: Get version
run: |
version=${{ inputs.version }}
if [ -n "$version" ]; then
echo "latest_release=$version" >> $GITHUB_ENV
else
echo "latest_release=$(curl --header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" --silent https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest | jq -r .tag_name | sed s/v// )" >> $GITHUB_ENV
fi

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

- name: Build and publish
uses: home-assistant/builder@master
with:
args: |
--${{ matrix.arch }} \
--version ${{ env.latest_release }} \
--target /data/ \
--addon
Loading