From 0598eac446c73df04802dc757da5a7af6a63c62a Mon Sep 17 00:00:00 2001 From: Levi Date: Fri, 17 Apr 2026 18:18:44 -0500 Subject: [PATCH] CI: auto-release on manifest version bump; validate on PR/push MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds .github/workflows/release.yml (for HA integrations, watches custom_components//manifest.json; for ha-adb-common, watches pyproject.toml). When the version field changes on main, the workflow creates a matching v tag and a GitHub Release with auto-generated notes — as long as the tag doesn't already exist. For the four HA integrations, also adds validate.yml running HACS's official validator and Home Assistant's hassfest against every PR, push to main, and nightly. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/release.yml | 51 ++++++++++++++++++++++++++++++++++ .github/workflows/validate.yml | 26 +++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..088aad0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Release + +on: + push: + branches: [main] + paths: + - custom_components/nvidia_shield/manifest.json + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Read version from manifest.json + id: version + run: | + VERSION=$(jq -r .version custom_components/nvidia_shield/manifest.json) + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "tag=v$VERSION" >> "$GITHUB_OUTPUT" + + - name: Check if tag already exists + id: check + run: | + if git ls-remote --tags origin "refs/tags/${{ steps.version.outputs.tag }}" | grep -q .; then + echo "exists=true" >> "$GITHUB_OUTPUT" + else + echo "exists=false" >> "$GITHUB_OUTPUT" + fi + + - name: Create tag + if: steps.check.outputs.exists == 'false' + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git tag -a "${{ steps.version.outputs.tag }}" -m "Release ${{ steps.version.outputs.tag }}" + git push origin "${{ steps.version.outputs.tag }}" + + - name: Create GitHub Release + if: steps.check.outputs.exists == 'false' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create "${{ steps.version.outputs.tag }}" \ + --title "${{ steps.version.outputs.tag }}" \ + --generate-notes diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..c33f4fa --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,26 @@ +name: Validate + +on: + push: + branches: [main] + pull_request: + schedule: + - cron: "0 6 * * *" + workflow_dispatch: + +jobs: + hacs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: HACS validation + uses: hacs/action@main + with: + category: integration + + hassfest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Hassfest validation + uses: home-assistant/actions/hassfest@master