BarkleyGitHub
Controls · REL
Markdown file

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.

From the 2026 sweep84 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 has more on this.

Controls

  1. REL-1Level 3Level markerBuild 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).

  2. REL-2Level 3Keep publishing secrets in a release environment. 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.

  3. REL-3Level 3 (or a tag ruleset)Level markerTurn 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.

  4. REL-4Level 3Don't commit build output you also release. 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.

Open the full page