Skip to content

Commit 8833b1e

Browse files
committed
port over some release managing stuff from govee2mqtt
1 parent 5935242 commit 8833b1e

File tree

4 files changed

+59
-1
lines changed

4 files changed

+59
-1
lines changed

.github/workflows/build.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
branches:
44
- main
55
push:
6+
tags:
7+
- "20*"
68
branches:
79
- main
810
paths:
@@ -34,6 +36,7 @@ jobs:
3436
tags: |
3537
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
3638
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }}
39+
type=ref,event=tag,enable=${{ github.ref_type == 'tag' }}
3740
type=ref,event=pr
3841
- name: Set up Docker Buildx
3942
uses: docker/setup-buildx-action@v3
@@ -148,6 +151,7 @@ jobs:
148151
tags: |
149152
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
150153
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }}
154+
type=ref,event=tag,enable=${{ github.ref_type == 'tag' }}
151155
type=ref,event=pr
152156
- name: Login to GHCR
153157
if: ${{ github.event_name != 'pull_request' }}
@@ -168,7 +172,7 @@ jobs:
168172
docker buildx imagetools inspect ${{ env.IMAGE_NO_TLS }}:${{ steps.meta.outputs.version }}
169173
170174
addon:
171-
if: ${{ github.event_name != 'pull_request' }}
175+
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
172176
runs-on: ubuntu-latest
173177
needs:
174178
- merge-no-tls
@@ -184,6 +188,8 @@ jobs:
184188
registry: https://ghcr.io
185189
username: ${{ github.repository_owner }}
186190
password: ${{ secrets.GITHUB_TOKEN }}
191+
- name: Apply tag to version
192+
run: ./scripts/apply-tag.sh
187193
- name: Build and Publish Home Assistant Add On
188194
uses: home-assistant/builder@master
189195
with:

addon/translations/en.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
configuration:
3+
hub_ip:
4+
name: PowerView Hub IP Address
5+
description: >-
6+
If MDNS doesn't work on your network, and you have configured
7+
a static IP address for your hub, you can specify the
8+
IP address of it here.
9+
mqtt_host:
10+
name: MQTT Broker Host Name
11+
description: >-
12+
The host name or IP address of the MQTT Broker on your network.
13+
If you are using the Mosquitto Addon, you can leave this blank
14+
as it will be handled automatically by Home Assistant.
15+
mqtt_port:
16+
name: MQTT Broker Port Number
17+
description: >-
18+
The port number of the MQTT Broker on your network.
19+
If you are using the Mosquitto Addon, you can leave this blank
20+
as it will be handled automatically by Home Assistant.
21+
mqtt_username:
22+
name: MQTT Broker Username
23+
description: >-
24+
If your MQTT broker requires authentication, the username that
25+
should be used.
26+
If you are using the Mosquitto Addon, you can leave this blank
27+
as it will be handled automatically by Home Assistant.
28+
mqtt_password:
29+
name: MQTT Broker Password
30+
description: >-
31+
If your MQTT broker requires authentication, the password that
32+
should be used.
33+
If you are using the Mosquitto Addon, you can leave this blank
34+
as it will be handled automatically by Home Assistant.
35+
debug_level:
36+
name: Debug Filter
37+
description: >-
38+
If you need to troubleshoot, set this to a Rust debug level filter.
39+
The easiest value to enter for this is "pview=trace".

scripts/apply-tag.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
# This script updates the version number for
3+
# the addon based on the current commit timestamp
4+
TAG_NAME=${TAG_NAME:-$(git -c "core.abbrev=8" show -s "--format=%cd-%h" "--date=format:%Y.%m.%d")}
5+
sed -i "s/version:.*/version: \"$TAG_NAME\"/" addon/config.yaml

scripts/tag-release.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
# This script sets things up to make a release,
3+
# creating a tag based on the current commit.
4+
TAG_NAME=${TAG_NAME:-$(git -c "core.abbrev=8" show -s "--format=%cd-%h" "--date=format:%Y.%m.%d")}
5+
git tag $TAG_NAME
6+
./scripts/apply-tag.sh
7+
git add addon/config.yaml
8+
git commit -m "Tag $TAG_NAME"

0 commit comments

Comments
 (0)