# Releases

Most people install your release, but reviewers and scanners read your repository. If the release is built in CI from code on main, the two match.

Source: https://ha-barkley.github.io/security/controls/releases/

From HASC, the Home Assistant Security Controls for integrations, cards and apps. A community catalog, not an official Home Assistant or Open Home Foundation project.

Each control has an ID, cited as HASC-CI-4, and a level from 1 to 3. "Level marker" means anyone can check the control from outside the project, and levels are graded on those controls only.

> **From the 2026 sweep.** 84 apps ship a release that differs from the repository's code at its tag, 85 released a tag whose commit isn't on main, and 9 ship code that isn't in the repository at all. The version scanned for 3,705 of 6,753 apps (54.9%) wasn't signed. The [Marketplace report](https://ha-barkley.github.io/marketplace/2026/releases/) has more on this.

## Controls

### REL-1: Build and publish releases from a workflow

*Level 3 · Level marker*

**Build and publish releases from a workflow** instead of your laptop. This one zips an integration, refuses a tag that isn't on main, adds a provenance attestation, and publishes the release with the zip in one step.

`.github/workflows/release.yaml`

```
name: Release
on:
  push:
    tags: ["v*"]
permissions:
  contents: write
  id-token: write
  attestations: write
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
        with:
          fetch-depth: 0
      - name: Only release code that's on main
        run: git merge-base --is-ancestor "$GITHUB_SHA" origin/main
      - name: Zip the integration
        run: |
          cd custom_components/your_domain
          zip -r "$GITHUB_WORKSPACE/your_domain.zip" .
      - uses: actions/attest-build-provenance@v4
        with:
          subject-path: your_domain.zip
      - name: Publish the release
        env:
          GH_TOKEN: ${{ github.token }}
        run: gh release create "$GITHUB_REF_NAME" your_domain.zip --verify-tag --generate-notes
```

Tell the Marketplace to install the zip with `"zip_release": true` and `"filename": "your_domain.zip"` in `hacs.json`. For a card, build the bundle in the workflow and attach the built file instead.

The "Only release code that's on main" step catches a tag pushed from the wrong branch by mistake. It can't stop someone with write access. The workflow that runs is the one in the tagged commit, so they could tag a commit whose workflow leaves that step out. A tag ruleset with *Restrict creations* stops that, because only the people on its bypass list can create release tags (see [Branch and tag protection](https://ha-barkley.github.io/security/controls/branches-and-tags/)).

### REL-2: Keep publishing secrets in a release environment

*Level 3*

If the release needs a secret, for example to push an image or publish a package, create an environment under Settings → Environments. Under Deployment branches and tags, allow only your release tags, add the secret to the environment instead of the repository, and add `environment: release` to the release job. A job started from any other branch or tag can't read it. With the tag ruleset above, only you can start one that can. Trusted publishing, where the registry supports it, needs no secret at all.

### REL-3: Turn on immutable releases

*Level 3 (or a tag ruleset) · Level marker*

**Turn on immutable releases** (Settings → General → Releases), so a published release's files and tag can't be swapped later. It applies to releases you publish after turning it on. Because assets can't be added after publishing, the workflow above creates the release and its file together.

### REL-4: Don't commit build output you also release

*Level 3*

If a card's `dist/` is in the repository, make the release workflow fail when a fresh build doesn't match it.

### Check it worked

Run `gh attestation verify your_domain.zip --repo OWNER/REPO` on a downloaded release. It should name your workflow and the commit it built from.

Barkley compares the release you'd install with the repository's code at its tag, and checks that the tag is on main.
