# Publishing a Coreapp

> Release a version of your app so any Core can install it from its repository.

- Web page: https://documentation.federated.computer/developer-tools/core-app-development-kit/publishing-a-coreapp/

A published Coreapp is a tagged commit in its git repository, plus its image in a container registry. A Core installs it by reading `coreapp.toml` and `icon.png` at the release's tag and pulling the image with the same version.

These steps use Gitea, which has a container registry on the same host as its repositories. Any git host and registry work the same way.

## Before the first release

1. Set `image` in `coreapp.toml` to your registry. On Gitea, that's `<gitea-host>/<owner>/<repository>` in lowercase, for example `gitea.example.com/my-team/timesheets`. `coreapp publish` suggests it from your git remote.
2. Log in to the registry once on your computer, with a Gitea token that has **write** access to **package**:

   ```
   docker login gitea.example.com
   ```

## Publish a release

1. Set `version` in `coreapp.toml`. Raise it for every release: a version that's already published is never replaced.
2. Commit everything. `coreapp publish` refuses uncommitted changes.
3. Publish:

   ```
   coreapp publish
   ```

   It builds the image for `linux/amd64`, pushes it as `image:version`, and tags the commit `v<version>`. For Cores on ARM servers too, add `--platform linux/amd64,linux/arm64`.

4. Push the commit and the tag:

   ```
   git push && git push origin v1.2.0
   ```

Cores can now install it with `coreapps install https://gitea.example.com/my-team/timesheets`, and update to it with `coreapps update timesheets`. See [Installing a Coreapp](https://documentation.federated.computer/hosting/coreapps/installing-a-coreapp/).

> **Publishing from Gitea Actions**
>
> Apps made with `coreapp new` include `.gitea/workflows/publish.yml`, which publishes when a `v*` tag is pushed. It needs an Actions runner that can use Docker, and the repository secrets `REGISTRY_USER` and `REGISTRY_TOKEN`.

## Check a release

Before telling people about a release, install it the way they will, from its repository, on the Core in your VM:

```
coreapp install https://gitea.example.com/my-team/timesheets
```

On the same Core, an app you deploy from your folder with `coreapp deploy` and one installed from its repository are the same app, with the same data.

## Fixing a release

A Core remembers the exact image it installed for each release, and refuses a different image pushed under the same version. To fix a release, publish a new version.

## Private apps

Your repository and package can stay private. Each Core that installs the app then needs a read-only token for them. See [Private Coreapps](https://documentation.federated.computer/hosting/coreapps/private-coreapps/).
