# Releases

A release marks a [tag](https://git.cafe/docs/repositories/tags.md) as a version of your project, with a title,
release notes and downloadable files. Open a repository's **Releases** tab to
see them, newest first. You need read access to the repository.

## Create a release

You need write access.

1. On the **Releases** tab, choose **Draft a new release**.
2. Enter a **Tag**. If the tag does not exist yet, pick the **Target** it is
   created from: a branch or a full commit hash (the default branch unless you
   choose another).
3. Add a title and release notes, then choose **Publish release**, or
   **Save draft** to finish it later.

From the command line:

```sh
cafe release create v1.0.0 --title "1.0.0" --notes-file notes.md
cafe release create v1.1.0 --target main --draft
```

A tag can have one release. Renaming a release's tag (`cafe release edit
v1.0.0 --new-tag v1.0.1`) needs a tag that already exists.

## Drafts

A draft is visible only to people with write access. Its tag is not created
until the draft is published: choose **Publish release**, or run
`cafe release publish v1.1.0`.

## Pre-releases and Latest

Check **Set as a pre-release** for a version that is not ready for everyone,
or pass `--prerelease`. The release marked **Latest** is the most recently
published one that is neither a draft nor a pre-release; a pre-release is never
marked **Latest**. `cafe release view --latest` shows it.

## Assets

Attach files to a release, such as binaries or installers. Each file can be up
to 2 GiB, a release can have up to 1000, and they count against the
organization's storage. Every release also offers **Source code (tar.gz)**, an
archive of the tagged tree. Anyone who can see a release can download its
files from the release page.

With write access, manage files from the release's **Edit** page, under
**Assets**:

1. Choose **Upload files** and select one or more files. They upload one at a
   time; each shows as uploading until it is done. A release must exist first,
   so save it (a draft is enough) before adding files.
2. A file that fails to upload stays in the list with the reason. If its upload
   was interrupted, it is listed as **Not uploaded**: delete it and upload the
   file again. An interrupted upload is removed on its own after 24 hours.
3. To remove a file, choose the delete button on its row and confirm.

A file's name must be unique in its release. You can also manage files through
the [API](https://git.cafe/docs/reference/api.md). The CLI cannot upload or download assets yet.

## Edit or delete a release

With write access, choose **Edit release** to change its tag, target, title,
notes or pre-release setting, or run `cafe release edit <tag>`. Choose
**Delete release** and confirm, or run `cafe release delete <tag> --yes`.
Deleting a release keeps its tag.

## GitHub sync

A repository synced from GitHub with [GitHub sync](https://git.cafe/docs/integrations/github-sync.md)
receives its releases from GitHub: the title, notes, tag, target, draft and
pre-release settings, publication time and author. Drafts arrive only when the
GitHub App can write the repository's contents, as GitHub shows drafts only to
people who can push. A release deleted on GitHub is deleted here too.

- A published release appears once its tag has synced from GitHub; until then
  it waits. Sync never creates or moves a tag for a release.
- A release's GitHub files (assets) are listed under **Assets**, marked with a
  link icon. They are not copied: each downloads from GitHub, so a private
  repository's files need a GitHub account that can see it. The list updates
  as GitHub's does, and it stops while you've edited the release here.
- Releases made in GitCafe are not sent to GitHub yet, even with two-way sync,
  so you can't create a release in a repository that syncs from GitHub. Create
  it on GitHub instead.
- You can still edit or delete a release that came from GitHub. GitHub's later
  changes to that release then stop arriving, so your edit is not overwritten.
- If a GitCafe release already uses the tag of a GitHub release, the GitHub
  release isn't imported.
