# Publishing

> A release is a git tag: rmp deploy checks it and pushes it, and CI builds every target the game has turned on and attaches them to a GitHub release.

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

A release is a git tag. `rmp deploy` checks the version the way CI will, tags the commit and pushes the tag; CI then builds every target your game has turned on, boots the ones it can, and attaches all of them to a GitHub release. From there each build goes where its platform wants it: a zip to download, a folder on itch.io, a bundle for Google Play.

```shell
rmp deploy 1.2.0
```

There is no version number anywhere in the project. The tag is the version: `v1.2.0` becomes the version Android and iOS show, the Android version code and the name of the release, so there is no number in a file to bump and none to forget. [Releases and versions](https://omardev29.github.io/rmp-docs/publishing/releases.html) has the whole of it: the shape a tag must have, what `rmp deploy` checks and in which order, and how to take a tag back.

## Before the first release

Four things are yours to decide once, and the first one cannot be changed afterwards.

1. **Give the game its real identifiers.** `rmp new` writes `com.example.` ids for Android and iOS, and a release is refused while either one still starts with `com.example.`: Google Play keeps an application id for good, so a game published under a placeholder would keep the placeholder.
   raylib_multiplatform.toml
   ```toml
   [android]
   application_id = "com.yourname.yourgame"

   [ios]
   bundle_id = "com.yourname.yourgame"
   ```
2. **Choose the targets.** `[targets] enabled` starts as `["all"]`, which is 17 of them. A target you switch off is not built, not tested and not released, and the release does not wait for it. The ids and the groups are in [the configuration reference](https://omardev29.github.io/rmp-docs/reference/configuration.html#section-targets).
3. **Decide where the saves go.** A zip that players unpack and run, which is what itch.io serves, wants `[save] portable = true`: the saves go in a folder beside the executable, and deleting the game deletes them. An installer, or Steam and its cloud saves, wants the default: the player's data folder. [Desktop and BSD archives](https://omardev29.github.io/rmp-docs/publishing/desktop.html#where-the-saves-go) has the folders.
4. **Add the secrets you need, on GitHub.** Nothing is needed for a release on GitHub itself. Signing for Google Play, uploading to itch.io and testing on Firebase each read secrets from the repository's settings, listed below. Without its secret each one says so in a warning and does without: the App Bundle is signed with a throwaway key, and nothing is uploaded or tested.

Then push your commits, so the commit you tag is one CI can check out. A game made with `rmp new` has a `main` branch that nothing ties to a remote yet: once `origin` is added, the first `rmp push` pushes `main` and sets it to track `origin`, and before that it says how to add one.

```shell
rmp push
rmp deploy 1.0.0
```

## What a release holds

One GitHub release per tag, with its notes generated by GitHub and, when the tag has a hyphen in it (`v1.2.0-rc1`), marked as a pre-release. Attached to it:

- A zip per desktop and BSD target: the executable, its assets in a `resources/` folder beside it — packed into one file, `resources.rres`, on most targets — and `LICENSES.txt`. The game finds its assets from whatever folder it is started in, except on NetBSD and OpenBSD, where it has to be started in its own. [Desktop and BSD archives](https://omardev29.github.io/rmp-docs/publishing/desktop.html).
- `web-build.zip`: the page, its script, the WebAssembly module, the preloaded assets and the web build's own `LICENSES.txt`. [The web build](https://omardev29.github.io/rmp-docs/publishing/web.html).
- The Android debug APK, and the signed App Bundle when the signing secrets are set. [Google Play](https://omardev29.github.io/rmp-docs/publishing/google-play.html).
- The iOS engine as an xcframework, and a simulator build of the app. [The App Store](https://omardev29.github.io/rmp-docs/publishing/app-store.html).
- `THIRD_PARTY_LICENSES.md`, and `SHA256SUMS` to check every download against.

The release is published only when every target that was built passed its checks. A tag that fails on any platform publishes nothing, so a release never has a hole where a platform should be.

## Where each build goes

| Page | What it covers |
|---|---|
| [Releases and versions](https://omardev29.github.io/rmp-docs/publishing/releases.html) | Tags, version names and the Android version code; every check `rmp deploy` makes; what CI does with a tag; undoing one. |
| [Desktop and BSD archives](https://omardev29.github.io/rmp-docs/publishing/desktop.html) | What is in each zip, what a release is hardened with, the glibc floor on Linux, compressing with UPX, signing. |
| [The web build](https://omardev29.github.io/rmp-docs/publishing/web.html) | The files, hosting them, memory, size and the browser backend. |
| [itch.io](https://omardev29.github.io/rmp-docs/publishing/itch.html) | Pushing every build to itch.io with butler, on every tag. |
| [Google Play](https://omardev29.github.io/rmp-docs/publishing/google-play.html) | The application id, signing the App Bundle, the version code, and Firebase Test Lab. |
| [The App Store](https://omardev29.github.io/rmp-docs/publishing/app-store.html) | What CI builds for iOS, what it leaves to Xcode on a Mac, and why. |
| [Continuous integration](https://omardev29.github.io/rmp-docs/publishing/ci.html) | What every push checks, what only a tag builds, the size every release binary is held to, what is pinned, and how to read a red run. |

## Secrets and variables

Everything CI needs that is not a secret lives in `raylib_multiplatform.toml`, next to the rest of the game. Everything that is a secret lives in the repository's settings on GitHub, under *Settings → Secrets and variables → Actions*, and nowhere else. These are all of them — every name the workflows a game carries read:

| Name | Kind | For |
|---|---|---|
| `ANDROID_KEYSTORE_BASE64` | secret | Your upload keystore, base64-encoded. With it set, CI signs the App Bundle with your key. [Google Play](https://omardev29.github.io/rmp-docs/publishing/google-play.html#signing) |
| `ANDROID_KEYSTORE_PASSWORD` | secret | The keystore's password. |
| `ANDROID_KEY_ALIAS` | secret | The key's alias inside the keystore. |
| `ANDROID_KEY_PASSWORD` | secret | The key's password. |
| `ANDROID_SIGNER_CN` | variable | Optional. The CN of your upload key, so CI checks the bundle is signed by that key and not merely by some key. |
| `BUTLER_API_KEY` | secret | An itch.io API key, for butler. [itch.io](https://omardev29.github.io/rmp-docs/publishing/itch.html) |
| `ITCH_USER`, `ITCH_GAME` | variables | Optional. When set, they win over `[deploy.itch]` in the .toml. |
| `GCP_SA_KEY` | secret | A Google Cloud service-account key, the whole JSON file, for Firebase Test Lab. [Google Play](https://omardev29.github.io/rmp-docs/publishing/google-play.html#firebase-test-lab) |
| `FIREBASE_PROJECT`, `FIREBASE_DEVICE` | variables | Optional. When set, they win over `[deploy.firebase]` in the .toml. |
| `FIREBASE_RESULTS_BUCKET` | variable | Optional. A Cloud Storage bucket the Test Lab results are written to and fetched back from. |
| `IOS_SIMULATOR_TEST` | variable | Optional. `true` turns on the iOS simulator boot test, which is off. [The App Store](https://omardev29.github.io/rmp-docs/publishing/app-store.html#what-ci-builds) |

NeverNever put a secret in `raylib_multiplatform.toml`. The file is committed, so anything in it is readable by everyone who can read the repository, for as long as the history exists. The keys the .toml does have under `[deploy]` — an itch.io user name, a Google Cloud project id — are names, not credentials.
