> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Bach builds Windows installers from one bach.toml with the bach command: bach init, bach check, bach preview, bach build. Installs are per user and need no administrator rights by default. installer.scope = "machine" installs for every user after one Windows prompt. On Windows, run setup files with Start-Process -Wait -PassThru in PowerShell, and give signtool arguments that start with the word sign.

# Release from GitHub with one click

> Add the release workflow with bach init or bach workflow, then press Run workflow: Bach raises every version file, builds, tags and publishes the release.

A Bach project on GitHub can release itself with one button. This page covers how to add the workflow, what it does when you start it, and how the version stays in one place. Installed apps update from what it publishes (see [Updates](/docs/guides/updates.md)).

## Add the workflow

Run one of these in your repository:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach init        # a new project: writes bach.toml and the workflow
bach workflow    # a project that already has a bach.toml
```

`bach init` adds the workflow by itself when the folder is a git checkout whose `origin` is on GitHub. `bach init --no-workflow` skips it. Both write `.github/workflows/bach-release.yml`. Commit and push it, then start a release on GitHub under **Actions › Release › Run workflow**, or from a terminal:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
gh workflow run bach-release.yml -f bump=minor
gh workflow run bach-release.yml -f version=2.0.0
gh workflow run bach-release.yml -f bump=patch -f prerelease=true
gh workflow run bach-release.yml -f bump=patch -f dry_run=true
```

Run `bach workflow` again whenever you want the newest version of the workflow. It only replaces a file that starts with Bach's own first line. Any other file with that name is left alone unless you pass `--force`.

## The inputs

| Input | Meaning |
| - | - |
| `bump` | Which part of the version goes up: `patch`, `minor`, `major`, or `current` to release the version as it is (the first release). |
| `version` | An exact version like `2.0.0` or `2.0.0-rc.1`. It replaces `bump` and is never lower than the current version. |
| `notes` | What's new, shown by apps that offer the update. Empty: GitHub's generated notes. |
| `prerelease` | Marks the release as a pre-release, so installed apps don't update to it. A version with a `-` is always a pre-release. |
| `draft` | Saves the release as a draft instead of publishing it. |
| `latest` | Turn it off for a fix to an older line, so installed apps stay on the newest release. |
| `dry_run` | Builds everything and keeps the setup file as a workflow artifact, but doesn't commit, tag or publish. |

## What a release does

**1. Raise the version**

Runs [`bach version`](/docs/reference/cli/version), which writes the new version into every file that has one. It stops if `v<version>` already exists as a tag.

**2. Install dependencies**

For a Node.js project, installs from the lock file. See [Lock files](#lock-files).

**3. Commit and tag**

Commits `Release v<version>` locally and tags it. Nothing is pushed yet.

**4. Build your app**

Builds into the folder `[files] source` names: `cargo build --release` for Rust, `npx tauri build --no-bundle` for Tauri, `npx electron-builder --win --dir` (or Electron Forge's `package`) for Electron, `dotnet publish -c Release -r win-x64 --self-contained` for .NET. For a project Bach doesn't recognise, the **Build your app** step holds a `TODO`: put your build commands there.

**5. Push**

Pushes the commit and the tag together. Nothing is pushed if an earlier step failed.

**6. Build the installer and publish**

Builds the setup file with the [Bach action](/docs/guides/ci.md), writes `latest.json` and publishes both as the GitHub release.

If the last step fails, the tag is deleted again, but the version files on the branch already say the new version. Run the workflow again with `bump` set to `current` to retry.

> [!NOTE]
>
> The workflow commits to the branch it runs on. If that branch is protected, let `github-actions[bot]` push to it, or run the workflow from a release branch.

## One version everywhere

The workflow doesn't edit versions itself. It runs `bach version`, which you can run by hand too, and which keeps `bach.toml`, `package.json` and its lock file, `Cargo.toml` and `Cargo.lock`, `src-tauri/tauri.conf.json` and `.csproj` files in step. Only the version text changes, so the commit shows one changed line per file. See [`bach version`](/docs/reference/cli/version) for the details.

## Lock files

The release installs dependencies with the frozen command of your package manager (`npm ci`, `pnpm install --frozen-lockfile`, `bun install --frozen-lockfile`, `yarn install --frozen-lockfile` or `--immutable`), picked by the lock file that is committed.

If that fails because `package.json` and the lock file have drifted apart, the workflow recognises the package manager's message, brings the lock file up to date from `package.json` (what the lock file pins stays pinned), prints a warning and installs again. The new lock file is part of the release commit. Any other failure stops the release with the real error. For Yarn Classic the lock file is updated with a plain `yarn install`.

With no lock file committed, the workflow runs `npm install` and says so. Commit a lock file for repeatable releases.

## Sign the setup file

The last step holds a commented `sign-command` input. Remove the `#`, keep the certificate in a repository secret, and the setup file is signed before the update feed is written, so the feed carries the signed file's SHA-256. See [Signing](/docs/guides/signing.md).

## A project in a subfolder

When `bach.toml` isn't in the repository's root, `bach workflow desktop` (the folder with the `bach.toml`) writes a workflow whose steps run in that folder. Version files are the ones next to `bach.toml`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.