From 4621747cf0ee0013ca15820eb82c5dbf8f0b1c2c Mon Sep 17 00:00:00 2001 From: "TheDave94 (via AI)" Date: Tue, 19 May 2026 11:38:51 +0000 Subject: [PATCH] chore(ci): release-please + release-build + ESLint enforcement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three CI additions: 1. .github/workflows/release-please.yml — googleapis/release-please-action maintains a permanent "Release PR" on main that bumps the version and updates CHANGELOG.md based on conventional commits (feat:/fix:/feat!:). Merging it creates the git tag + GitHub Release. No more manual version bumps or hand-written changelog entries. 2. .github/workflows/release-build.yml — listens for release.published, checks out the tag, runs `npm ci && npm run build`, zips dist/, and attaches the zip to the GitHub Release as `simon42-dashboard-strategy.zip`. Includes a workflow_dispatch trigger so a release can be re-built without a new tag (e.g. if the build was broken at release time). 3. .github/workflows/validate.yml — adds a `lint` job that runs `npm run lint` (eslint over src/**/*.ts). Catches regressions earlier than Codacy and without Codacy's noise (yesterday's incident with Biome/Qwik false positives on a Node script). For now hacs.json is unchanged — HACS continues to serve dist/ from the repo at the tag, and the maintainer continues to commit dist/ manually before merging a release PR. The release-build workflow's zip is a download-convenience artifact. Future work could flip hacs.json to zip_release: true to make the zip the source of truth, fully removing the manual dist commit; left out of this PR to keep the change small and backward-compatible. --- .github/workflows/release-build.yml | 66 ++++++++++++++++++++++++++++ .github/workflows/release-please.yml | 34 ++++++++++++++ .github/workflows/validate.yml | 13 ++++++ 3 files changed, 113 insertions(+) create mode 100644 .github/workflows/release-build.yml create mode 100644 .github/workflows/release-please.yml diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml new file mode 100644 index 00000000..ea2b81d8 --- /dev/null +++ b/.github/workflows/release-build.yml @@ -0,0 +1,66 @@ +name: Release Build + +# Triggered when release-please publishes a new GitHub Release. +# Builds dist/ from source at the tagged commit, zips it, and attaches +# the zip as a release asset. HACS picks up the zip via hacs.json's +# `zip_release: true` flag. +# +# Separates concerns from release-please: that workflow owns versioning +# + changelog + tagging; this one owns producing the artifact users +# install. Either can be retried independently. + +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: 'Tag to build (e.g. v1.4.0). Defaults to the latest release.' + required: false + +permissions: + contents: write + +jobs: + build: + name: Build + attach dist zip + runs-on: ubuntu-latest + steps: + - name: Determine ref + id: ref + run: | + if [ -n "${{ github.event.inputs.tag }}" ]; then + echo "ref=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT" + else + echo "ref=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" + fi + + - uses: actions/checkout@v4 + with: + ref: ${{ steps.ref.outputs.ref }} + + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Package dist into a zip + run: | + cd dist + zip -r ../simon42-dashboard-strategy.zip . + cd .. + ls -la simon42-dashboard-strategy.zip + + - name: Attach zip to the release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release upload "${{ steps.ref.outputs.ref }}" \ + simon42-dashboard-strategy.zip \ + --clobber diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..bec63f13 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,34 @@ +name: Release Please + +# Manages version bumps + changelog + tags via conventional commits. +# +# How it works: +# 1. On every push to main, this workflow checks the commits since the last +# release. If any commits follow Conventional Commits format (feat:, fix:, +# feat!: etc.), it maintains a permanent "Release PR" that: +# - bumps package.json's version (patch / minor / major based on commits) +# - updates CHANGELOG.md +# 2. When the maintainer merges that PR, release-please creates a git tag +# and a GitHub Release with the changelog as the body. +# 3. The release event triggers .github/workflows/release-build.yml, which +# builds dist/ and attaches a zip as a release asset for HACS. +# +# The maintainer's job is simply to merge the Release PR when ready — +# no manual version bumps, no manual changelog edits, no manual tagging. + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@v4 + with: + release-type: node diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 1616e77c..dfba79b3 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -18,3 +18,16 @@ jobs: - uses: hacs/action@main with: category: plugin + + lint: + name: ESLint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + - run: npm ci + - name: Run ESLint + run: npm run lint