Skip to content

Commit b167d8c

Browse files
committed
Add required hacs settings and validate/release workflows
1 parent 229c507 commit b167d8c

4 files changed

Lines changed: 92 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
release:
14+
name: Build release
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Check out repository
19+
uses: actions/checkout@v4
20+
21+
- name: Validate tag and manifest version
22+
if: github.event_name == 'push'
23+
shell: bash
24+
run: |
25+
set -euo pipefail
26+
27+
TAG="${GITHUB_REF_NAME#v}"
28+
MANIFEST_VERSION="$(python3 -c 'import json; print(json.load(open("custom_components/esphome_packages_updater/manifest.json"))["version"])')"
29+
30+
if [[ ! "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
31+
echo "Tag $GITHUB_REF_NAME is not a supported version tag."
32+
exit 1
33+
fi
34+
35+
if [[ "$TAG" != "$MANIFEST_VERSION" ]]; then
36+
echo "Tag version $TAG does not match manifest version $MANIFEST_VERSION."
37+
exit 1
38+
fi
39+
40+
- name: Build HACS ZIP
41+
shell: bash
42+
run: |
43+
set -euo pipefail
44+
45+
cd custom_components/esphome_packages_updater
46+
47+
zip -r "${GITHUB_WORKSPACE}/esphome_packages_updater.zip" . \
48+
-x "*/__pycache__/*" "*.pyc" "*.pyo" ".DS_Store"
49+
50+
- name: Upload workflow artifact
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: esphome_packages_updater
54+
path: esphome_packages_updater.zip
55+
if-no-files-found: error
56+
57+
- name: Publish GitHub release
58+
if: github.event_name == 'push'
59+
env:
60+
GH_TOKEN: ${{ github.token }}
61+
shell: bash
62+
run: |
63+
gh release create "$GITHUB_REF_NAME" esphome_packages_updater.zip \
64+
--verify-tag \
65+
--generate-notes \
66+
--title "$GITHUB_REF_NAME"

.github/workflows/validate.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Validate
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: "0 0 * * *"
8+
workflow_dispatch:
9+
10+
permissions: {}
11+
12+
jobs:
13+
validate-hacs:
14+
runs-on: "ubuntu-latest"
15+
steps:
16+
- name: HACS validation
17+
uses: "hacs/action@main"
18+
with:
19+
category: "integration"
20+
ignore: "brand"

custom_components/esphome_packages_updater/manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"config_flow": true,
77
"single_config_entry": true,
88
"documentation": "https://github.com/ludero-git/esphome-packages-updater",
9+
"issue_tracker": "https://github.com/ludero-git/esphome-packages-updater/issues",
910
"integration_type": "service",
1011
"iot_class": "cloud_polling"
1112
}

hacs.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"name": "ESPHome Packages Updater"
2+
"name": "ESPHome Packages Updater",
3+
"zip_release": true,
4+
"render_readme": true,
5+
"hide_default_branch": true,
6+
"filename": "esphome_packages_updater.zip"
37
}

0 commit comments

Comments
 (0)