Skip to content

Commit

Permalink
chore: Versioning and release clean-ups
Browse files Browse the repository at this point in the history
- note in const that version is set by release only
- tweaks to release.yaml
- remove version info from entity.py since devices/entities don't need it.
- set repo version of manifest.json back to 0.0.0
- lifted some release settings from spook
  • Loading branch information
agittins committed Jan 6, 2024
1 parent d6a2907 commit 8f03a1c
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 5 deletions.
28 changes: 28 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
sort-direction: ascending

categories:
- title: ":boom: Breaking Changes"
label: "breaking"
Expand All @@ -23,6 +29,28 @@ categories:
labels:
- "dependencies"
- "build"

version-resolver:
major:
labels:
- "major"
- "breaking-change"
minor:
labels:
- "minor"
- "new-feature"
patch:
labels:
- "bugfix"
- "chore"
- "ci"
- "dependencies"
- "documentation"
- "enhancement"
- "performance"
- "refactor"
default: patch

template: |
## Changes
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,33 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
env:
BERMUDA_ROOT_DIR: "${{ github.workspace }}/custom_components/bermuda"
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set release version number in files
shell: bash
run: |
sed -i '/VERSION.=./c\VERSION = "${{ github.ref_name }}"' "${{ env.BERMUDA_ROOT_DIR }}/const.py"
(jq '.version = "${{ github.ref_name }}"' "${{ env.BERMUDA_ROOT_DIR }}/manifest.json") > "${{ env.BERMUDA_ROOT_DIR }}/manifest.json.tmp"
version="${{ github.event.release.tag_name }}"
version="${version,,}"
version="${version#v}"
sed -i '/VERSION.=./c\VERSION = "${version}"' "${{ env.BERMUDA_ROOT_DIR }}/const.py"
(jq '.version = "${version}"' "${{ env.BERMUDA_ROOT_DIR }}/manifest.json") > "${{ env.BERMUDA_ROOT_DIR }}/manifest.json.tmp"
mv "${{ env.BERMUDA_ROOT_DIR }}/manifest.json.tmp" "${{ env.BERMUDA_ROOT_DIR }}/manifest.json"
- name: Zip the integration directory
run: |
cd "${{ env.BERMUDA_ROOT_DIR }}"
zip bermuda.zip -r ./
- name: 🔏 Sign release package
uses: sigstore/[email protected]
with:
inputs: "${{ env.BERMUDA_ROOT_DIR }}/bermuda.zip"

- name: "Upload the ZIP file to the release"
uses: softprops/[email protected]
with:
Expand Down
5 changes: 5 additions & 0 deletions custom_components/bermuda/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
NAME = "Bermuda BLE Trilateration"
DOMAIN = "bermuda"
DOMAIN_DATA = f"{DOMAIN}_data"
# Version gets updated by github workflow during release.
# The version in the repository should always be 0.0.0 to reflect
# that the component has been checked out from git, not pulled from
# an officially built release. HACS will use the git tag (or the zip file,
# either way it works).
VERSION = "0.0.0"

ATTRIBUTION = "Data provided by http://jsonplaceholder.typicode.com/"
Expand Down
4 changes: 2 additions & 2 deletions custom_components/bermuda/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .const import ATTRIBUTION
from .const import DOMAIN
from .const import NAME
from .const import VERSION

if TYPE_CHECKING:
from . import BermudaDataUpdateCoordinator
Expand Down Expand Up @@ -44,7 +43,8 @@ def device_info(self):
return {
"identifiers": {(DOMAIN, self._device.unique_id)},
"name": self._device.prefname,
"model": VERSION,
# TODO: Could use this to indicate tracker type (IRK, iBeacon etc).
# "model": "some string",
"manufacturer": NAME,
}

Expand Down
2 changes: 1 addition & 1 deletion custom_components/bermuda/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"iot_class": "calculated",
"issue_tracker": "https://github.com/agittins/bermuda/issues",
"requirements": [],
"version": "0.0.1"
"version": "0.0.0"
}

0 comments on commit 8f03a1c

Please sign in to comment.