# itch.io

> On every release tag CI pushes each build itch.io can use to your game's page with butler; it needs a user, a game and one secret.

Source: https://omardev29.github.io/rmp-docs/publishing/itch.html

Once it is set up, every release tag puts your game on itch.io by itself: CI pushes each build itch.io can use to its own channel of your game's page with butler, itch.io's upload tool, and the web build plays in the page. It needs two names in the .toml and one secret on GitHub.

## Setting it up

1. **Make the game's page on itch.io**, if it does not exist yet. Its address, `https://yourname.itch.io/your-game`, holds the two names CI needs: your user name and the game's slug.
2. **Write them in the .toml.** They are names, not secrets, so they live with the rest of the game:
   raylib_multiplatform.toml
   ```toml
   [deploy.itch]
   user = "yourname"
   game = "your-game"
   ```
3. **Add the API key as a secret.** Make a key on [itch.io's API keys page](https://itch.io/user/settings/api-keys) and store it in the repository as `BUTLER_API_KEY` — under *Settings → Secrets and variables → Actions*, or from a terminal:
   ```shell
   gh secret set BUTLER_API_KEY
   ```
4. **Release.** The next tag publishes:
   ```shell
   rmp deploy 1.0.0
   ```

The two names go together. With one of them set and the other empty, CI would have no `user/game` to push to and would skip the upload without anyone asking for that, so the configuration refuses it:

raylib_multiplatform.toml

```toml
[deploy.itch]
user = "yourname"
```

```text
  raylib_multiplatform.toml:1: [deploy.itch]
                               ^^^^^^^^^^^^^

  configure: error: [deploy.itch] user and game go together, and game is empty.
                    The itch job needs both to build the target `user/game:channel`, so with one of them missing it skips and the release is never pushed.
                    Set game, or clear both to turn itch.io deployment off.
```

Both may hold letters, digits, `_` and `-`, and nothing else. Leave both empty, as a new game has them, and itch.io is simply off: the job logs a warning and does nothing, so a game that does not use itch.io never gets a red run over it.

The repository variables `ITCH_USER` and `ITCH_GAME` are read too, and when set they win over the .toml. If a value in the .toml seems ignored, look there first.

## Channels

A butler upload goes to a channel of the game, and itch.io works out the platform of a download from the channel's name, out of a fixed set it recognises. CI pushes these:

| Channel | What is pushed | itch.io sees |
|---|---|---|
| `linux-x64-glibc` | the Linux x86-64 archive, unpacked | Linux |
| `linux-arm64-glibc` | the Linux ARM64 archive, unpacked | Linux |
| `linux-riscv64-glibc` | the Linux RISC-V archive, unpacked | a download with no platform: itch.io has no RISC-V |
| `windows-x64` | the Windows x86-64 archive, unpacked | Windows |
| `windows-arm64` | the Windows ARM64 archive, unpacked | Windows |
| `osx` | the macOS archive, unpacked | macOS |
| `html5` | the web build, as a folder with `index.html` at its root | a game that plays in the browser |
| `android` | the debug APK | Android |

The archives are unpacked before they are pushed, so the player gets a folder rather than a zip inside a zip, and butler can upload only what changed since the last version.

The web build is the one that is easy to get wrong by hand: itch.io plays an HTML5 game from an `index.html` at the root of an uploaded folder, and a zip pushed as it is becomes a file to download that nobody can play. So CI unpacks `web-build.zip` and copies `my_game.html` to `index.html` before it pushes.

The Android channel gets the debug APK, the build CI makes on every run — Google Play is where the signed release bundle goes ([Google Play](https://omardev29.github.io/rmp-docs/publishing/google-play.html)). A debug build shows Google's test ads whatever ids the .toml carries, so a game with ads earns nothing from the APK players download here.

Some targets have no channel, on purpose, and stay on the GitHub release only:

- `linux-x64-musl`: the same game as `linux-x64-glibc` for Alpine. A second Linux x86-64 channel would show players two identical downloads, with no way on itch.io to say which one is for them.
- `linux-x64-glibc-drm` and `linux-arm64-glibc-drm`: they boot straight onto the screen with no desktop. Right for a kiosk or a Pi, wrong for a player who double-clicks it inside a desktop session.
- The BSD builds: itch.io has no BSD platform.
- `ios`: there is no way to install an iOS app from a downloaded file.

## Versions

Each push carries the tag as its version — `v1.2.0`, `v` and all — and itch.io shows it on the page. The version also makes a push repeatable: running the same tag again does not create a second build on itch.io.

This is the command each channel runs, with `payload` the unpacked build:

```shell
butler push payload yourname/your-game:html5 --userversion v1.2.0
```

## When it runs

Only on a tag, and only after the GitHub release has been published: a tag whose build failed anywhere pushes nothing to itch.io either. Each channel is a job of its own, so one channel failing — an expired key, a network error — fails that job, visibly, and leaves the others to finish. A channel whose target you switched off finds no build to push and does nothing.

butler comes from CI's pinned image, at the version recorded in `thirdparty/FROZEN_VERSIONS.md` and checked against its checksum when the image was built. Nothing fetches it from the network while a release is being published.

## Saves in a downloaded build

A player who downloads from itch.io gets a folder, runs the game from it, and deletes the folder when done. `[save] portable = true` keeps the saves inside that folder, so deleting the game deletes them too:

raylib_multiplatform.toml

```toml
[save]
portable = true
```

It applies to the Windows and Linux builds; macOS, the web and Android keep their saves where those platforms keep them. [Where the saves go](https://omardev29.github.io/rmp-docs/publishing/desktop.html#where-the-saves-go) has the folders.
