# Publish a revision

> Build your project and roll it out to the servers of a Connect network whose labels match a selector, with mk publish. Each server swaps the new revision in while players stay connected.

`mk publish` takes your game from your machine to the servers of a network. It builds the project the way `mk dev` does, uploads its bundles as a revision, and assigns the revision to a label selector.

**Before you start:** you need a network with at least one server in it. See [Create a network](https://minekube.com/guide/networks/create-a-network) and [Let servers in](https://minekube.com/guide/networks/let-servers-in) in Connect. During the preview, set `MINEKUBE_REGISTRY=https://registry.staging.minekube.net`.

## Publish to every server

In your project:

```sh
mk publish --network my-network
```

Without a selector, every server of the network runs the revision. The revision is named by the hash of its bundles, so publishing the same code twice makes no new revision.

## Publish to some servers

Pass a selector with `-l`:

```sh
mk publish --network my-network -l channel=canary
```

Every server whose labels match runs the revision. A label comes from the server itself, in its `connector.json`, or from the invite or trust rule that let it in. A canary is a set of servers labelled `channel=canary`, so you try a revision there first and then publish it to everyone.

## Watch it arrive

Each server's connector gets the new assignment, downloads the bundles it does not have, and the Minekube plugin swaps the game in. Players stay connected. On the server, the log says `Reloaded <id> (<revision>)`.

`mk revisions --network my-network` shows what runs where, since when and by whom.

## Related

- [Roll back and unpublish](https://minekube.com/games/versions-and-deployments/rollback): go back to an earlier revision.
- [How servers get their bundles](https://minekube.com/games/versions-and-deployments/bundle-delivery): what happens between `mk publish` and the swap.
- [CLI reference](https://minekube.com/games/reference/cli#mk-publish): every flag of `mk publish`.
