diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..87ffe59 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Release + +on: + push: + branches: + - "claude/release-latest-commit-**" + tags: + - "v*" + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Resolve tag and publish release + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + if [[ "${GITHUB_REF}" == refs/tags/* ]]; then + TAG="${GITHUB_REF_NAME}" + else + VER="$(python3 -c "import json; print(json.load(open('custom_components/smart_climate/manifest.json'))['version'])")" + TAG="v${VER}" + fi + echo "Releasing ${TAG}" + + if git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then + echo "Tag ${TAG} already exists on origin; skipping tag creation." + else + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git tag -a "${TAG}" -m "Smart Climate Controller ${TAG}" + git push origin "${TAG}" + fi + + if gh release view "${TAG}" >/dev/null 2>&1; then + echo "Release ${TAG} already exists; nothing to do." + else + gh release create "${TAG}" \ + --title "${TAG}" \ + --generate-notes \ + --verify-tag + fi diff --git a/custom_components/smart_climate/manifest.json b/custom_components/smart_climate/manifest.json index 81202f3..1fc5f5a 100644 --- a/custom_components/smart_climate/manifest.json +++ b/custom_components/smart_climate/manifest.json @@ -1,7 +1,7 @@ { "domain": "smart_climate", "name": "Smart Climate Controller", - "version": "1.0.0", + "version": "1.1", "documentation": "https://github.com/JansenDevelopment/Smart-Climate-Controller", "dependencies": [], "codeowners": ["@JansenDevelopment"],