# Releases

How sculk.network, OAuthMC and Sculkworm get from `main` to the people who run them. [AGENTS.md](https://github.com/YellowUmbrellaDev/sculk.network/blob/96e9a1b/AGENTS.md) holds the short rules; this guide holds the model and the steps. The `release` workflow does the work, and `scripts/release.mjs` decides what it publishes.

## Channels

| Channel | Comes from | When | Version | Image tags | GitHub Release |
| --- | --- | --- | --- | --- | --- |
| dev.sculk.network | `main` | Every merge | `0.0.0-dev` | `:dev`, `:sha-<7>` | None |
| Nightly | `main` | Every night at 03:17 UTC, if something changed and `ci-ok` passed | `0.3.0-nightly.20261126.57` | `:nightly`, the version | Pre-release |
| Stable | A nightly, unchanged | When a maintainer decides | `0.3.0` | `:latest`, `:0.3`, from 1.0.0 also `:1`, the version | Latest (sculk.network only) |

A nightly carries the number of the next stable release (one minor above the last one), then the date and the run number. By SemVer, `0.3.0-nightly.…` sorts after `0.2.0` and before `0.3.0`.

A stable release is a nightly that people already ran: the workflow publishes the exact commit of the latest nightly, it does not take what `main` holds that day.

Until 1.0.0, stable is the public beta: a minor release (`0.3.0` after `0.2.0`) may change the API, the plugin format, `sculk.json` or the settings, and its notes say how. Migrations always upgrade the data. From 1.0.0, stable follows SemVer: removing or breaking anything a user relies on takes a new major version.

## Products

sculk.network, OAuthMC and Sculkworm each have their own version, tags and images. A product gets a nightly only when something in its image changed since its last one, and its release notes list only the commits that touched it.

| Product | Tag | Image | Release assets | Built from |
| --- | --- | --- | --- | --- |
| sculk.network | `v0.3.0` | `ghcr.io/yellowumbrelladev/sculk.network` | Container image only | The root `Dockerfile`: `apps/server`, `apps/web`, `packages`, `plugins`, `clients/sync`, the OAuthMC and Sculkworm JS SDKs |
| OAuthMC | `oauthmc-v0.3.0` | `ghcr.io/yellowumbrelladev/oauthmc` | Container image only | `crates/oauthmc` |
| Sculkworm | `sculkworm-v0.3.0` | `ghcr.io/yellowumbrelladev/sculkworm` | Container image, per-target binary archives, `sculkworm-connect.jar`, and `SHA256SUMS` | `crates/sculkworm`, `clients/sync/src`, `clients/sync/build.sh` |

No file in the repository holds a version. The workflow stamps it into the image: sculk.network reads `SCULK_VERSION` and reports it in `/healthz`, `GET /api/build` and the User-Agent; the crate images carry it in the `org.opencontainers.image.version` label. `Cargo.toml` stays at `0.1.0`, and the crates are not published to crates.io. The Releases page is the changelog.

Only a stable sculk.network release becomes the Latest release on GitHub. A crate's stable release does not.

### Sculkworm release assets

Every Sculkworm release (nightly, stable promotion, and fix release) publishes the relay container image `ghcr.io/yellowumbrelladev/sculkworm:<version>`, standalone binary archives, and the Java 8+ `sculkworm-connect.jar` attached to the `sculkworm-v<version>` GitHub Release. Each archive contains the binaries listed below, `LICENSE`, and a short `README.txt` pointing to the documentation, packed reproducibly from the release commit timestamp.

| Archive | Target | Binaries included | Notes |
| --- | --- | --- | --- |
| `sculkworm-<version>-x86_64-unknown-linux-musl.tar.gz` | Linux x86_64 (static musl) | `sculkworm`, `sculkworm-agent`, `sculkworm-connect` | Self-contained static binaries for servers and desktops |
| `sculkworm-<version>-aarch64-unknown-linux-musl.tar.gz` | Linux ARM64 (static musl) | `sculkworm`, `sculkworm-agent`, `sculkworm-connect` | Self-contained static binaries for ARM64 servers and SBCs |
| `sculkworm-<version>-x86_64-apple-darwin.tar.gz` | macOS Intel (11.0+) | `sculkworm`, `sculkworm-agent`, `sculkworm-connect` | Unsigned cross-compiled Mach-O binaries |
| `sculkworm-<version>-aarch64-apple-darwin.tar.gz` | macOS Apple Silicon (11.0+) | `sculkworm`, `sculkworm-agent`, `sculkworm-connect` | Unsigned cross-compiled Mach-O binaries |
| `sculkworm-<version>-x86_64-pc-windows-gnu.zip` | Windows x86_64 (UCRT) | `sculkworm-connect.exe` | Player client only (relay/agent `SIGHUP` reload and `0600` secret checks are Unix-only); cross-compiled with Zig against Windows UCRT instead of `x86_64-pc-windows-msvc` |
| `sculkworm-connect.jar` | Java 8+ (cross-platform) | `network.sculk.sync.SculkwormConnect` (`Main-Class`, `Premain-Class`) | Standalone Java 8 player client and `-javaagent` built from `clients/sync/src` inside `eclipse-temurin:17-jdk` |
| `SHA256SUMS` | All targets | — | Sorted SHA-256 checksums for every archive and `sculkworm-connect.jar` in the release |

The `binaries` job cross-compiles every Rust target from the Linux Blacksmith runner with pinned Zig and `cargo-zigbuild` (plus the pinned `MacOSX11.3.sdk` for Darwin targets), the `connect-jar` job builds `sculkworm-connect.jar` inside `eclipse-temurin:17-jdk` via `clients/sync/build.sh` and uploads only `sculkworm-connect.jar`, and the `publish` job attaches every asset and `SHA256SUMS` to the GitHub Release with `gh release upload --clobber` before moving the floating container tags (`:nightly`, `:latest`, `:X.Y`). Re-running failed jobs overwrites or skips existing assets idempotently.

Verify a downloaded archive against `SHA256SUMS` before unpacking it:

```sh
TAG=sculkworm-v0.1.0-nightly.20261127.5
VERSION=${TAG#sculkworm-v}
ARCHIVE="sculkworm-${VERSION}-x86_64-unknown-linux-musl.tar.gz"
curl -sSfLO "https://github.com/YellowUmbrellaDev/sculk.network/releases/download/${TAG}/${ARCHIVE}"
curl -sSfLO "https://github.com/YellowUmbrellaDev/sculk.network/releases/download/${TAG}/SHA256SUMS"
sha256sum -c SHA256SUMS --ignore-missing
tar -xzf "$ARCHIVE"
./sculkworm-connect --help
```

```text
sculkworm-0.1.0-nightly.20261127.5-x86_64-unknown-linux-musl.tar.gz: OK
Usage: sculkworm-connect <command> [OPTIONS]
   or: sculkworm connect <command> [OPTIONS]

Commands:
  play <host[:port]>     Log in if needed and open a local Minecraft listener for <host>
  login <host[:port]>    Log in to a closed route via browser redirect or device flow
  logout <route|--all>   Revoke and remove a stored login (or all logins)
```

## Branches

| Branch | Holds | Who writes to it |
| --- | --- | --- |
| `main` | The next release. Every PR targets it, and it is the default branch | PRs, by squash merge |
| `release-<product>-X.Y` | Fixes for an older stable line, such as `release-sculk-0.3` | Fix PRs, only when needed |

No branch tracks what is released: the tags do (`v0.3.0`, `oauthmc-v0.3.0`), and the Releases page marks the newest sculk.network release as Latest. Nobody pushes to `main` or tags by hand. The one push a person makes by hand is the first one to a release branch, which creates it from a stable tag; see [Fix a stable release](#fix-a-stable-release).

## Publish a nightly

Nothing to do: the workflow runs every night. To publish one now, for example to test a fix on a nightly instance, run **release** from the Actions tab on `main` with `channel` `nightly`, or:

```sh
gh workflow run release --ref main -f channel=nightly -f product=all
```

The run plans first and prints what it will publish and what it skips:

```text
v0.3.0-nightly.20261126.57 from 1a2b3c4d…
  ghcr.io/yellowumbrelladev/sculk.network:0.3.0-nightly.20261126.57
  ghcr.io/yellowumbrelladev/sculk.network:nightly
Notice: OAuthMC: nothing in its image changed since oauthmc-v0.1.0-nightly.20261125.50.
```

When `ci-ok` has not passed on the head of `main`, it publishes nothing.

To pull a bad nightly, delete its GitHub Release and tag (which removes any attached binary archives and `SHA256SUMS` as well), and point `:nightly` back at the previous one:

```sh
gh release delete v0.3.0-nightly.20261126.57 --cleanup-tag --yes
docker buildx imagetools create -t ghcr.io/yellowumbrelladev/sculk.network:nightly \
  ghcr.io/yellowumbrelladev/sculk.network:0.3.0-nightly.20261125.50
```

## Publish a stable release

1. Pick the nightly. The default rule: it has run for seven days, on dev.sculk.network and on at least one nightly instance, with no open issue that blocks it. Look at its notes on the Releases page and at what is still behind a [feature stage](#feature-stages).
2. Run **release** from the Actions tab on `main` with `channel` `stable` and the product. Leave `version` empty to publish the version the nightly previews (`0.3.0` for `0.3.0-nightly.…`), or type a higher one, such as `1.0.0` for the first stable release:

   ```sh
   gh workflow run release --ref main -f channel=stable -f product=sculk
   ```

   Only someone with the admin or maintain role on the repository can run it. GitHub has no approval step for environments of a private repository on the Free plan, so the plan checks the role of whoever started the run and stops otherwise:

   ```text
   Error: A stable release takes the admin or maintain role on the repository, and someone has write.
   ```

3. Check the result: the GitHub Release exists, and the image answers with the version.

   ```sh
   docker run --rm -d --name check -p 8081:8080 ghcr.io/yellowumbrelladev/sculk.network:0.3.0
   curl -s http://localhost:8081/healthz
   docker rm -f check
   ```

   ```json
   {"ok":true,"version":"0.3.0","commit":"1a2b3c4d…"}
   ```

The planner promotes the latest nightly of that product, so publish it before a newer nightly replaces it, or wait for the next one. It refuses a nightly that a stable release already shipped (wait for the next nightly) and a version lower than the one the nightly previews.

When a run fails halfway, for example after the image is pushed or binary archives are built but before the GitHub Release or its assets are uploaded, open it and choose **Re-run failed jobs**. Every step skips or overwrites (`--clobber`) what the first attempt finished, and the floating tags (`:latest`, `:0.3`, `:nightly`) move only at the end, so people who follow them never get an image without its release and assets.

### Documentation site

After a stable release finishes, the `release` workflow dispatches `deploy-docs`, which rebuilds `https://docs.sculk.network` (updating `/stable/` from each product's latest stable tag `vX.Y.Z`, `oauthmc-vX.Y.Z`, `sculkworm-vX.Y.Z`, alongside `/nightly/` from `main`). The deploy runs in its own concurrency group so a docs failure never stalls or marks a release as failed. The Cloudflare API token lives in the `docs` environment as `CLOUDFLARE_DOCS_TOKEN` (see [Documentation site](https://docs.sculk.network/nightly/sculk/development.md#documentation-site)).

## Fix a stable release

A fix for the newest stable line usually waits for the next stable release: merge it into `main`, then promote the next nightly. When it cannot wait, or when it fixes an older line people still run:

1. Merge the fix into `main` first, as usual.
2. Create the release branch from the stable tag, if it does not exist yet, and cherry-pick the fix onto a branch cut from it. `-x` records where the commit came from, which `ci` checks:

   ```sh
   git fetch --tags origin
   git push origin v0.3.0^{commit}:refs/heads/release-sculk-0.3
   git switch -c fix-restart-timeout-0.3 origin/release-sculk-0.3
   git cherry-pick -x <commit in main>
   ```

3. Open a PR into `release-sculk-0.3`. The `branch-flow` job of `ci` fails if a commit in it, other than a merge commit, is not a cherry-pick of a commit in `main`. It reads the `-x` trailer, so it catches a fix that never went into `main`; the maintainer who publishes still reviews what the PR changes. Merge it once every check passes.
4. Run **release** on `release-sculk-0.3` with `channel` `stable` and `product` `sculk`. It publishes `v0.3.1` from the head of the branch. It moves `:0.3`, `:0` from 1.0.0 on if that major has nothing newer, and `:latest` only if 0.3 is still the newest line.

Delete a release branch once nobody runs that line.

## Feature stages

A stable release is a copy of a nightly, so everything merged into `main` reaches stable. A feature flag is how unfinished work rides along without showing up there. Use one for a user-visible feature that will not be finished before the next stable release. Never gate a bug fix or a small change.

Flags live in one map in `apps/server/src/config/features.ts`. Each entry names its stage (`nightly` or `labs`), where its Labs toggle will live (`user` or `server`), and a short description:

```ts
export const FEATURES = {
	myFeature: {
		stage: 'nightly',
		scope: 'server',
		about: 'Short description of what the feature adds.',
	},
} as const satisfies Record<string, FeatureDef>;
```

Every feature follows the same path, one small PR per step:

1. `nightly` while it is unfinished: on in dev and nightly builds, off in stable.
2. `labs` when it is finished: still on in nightly builds, off by default in stable, where the Labs page will let people switch it on.
3. Removed from `FEATURES` once it is trusted, together with every check for it. The next stable release ships it to everyone.

Check the flag in the route or service as well as in the UI, so a hidden feature cannot be called directly:

```ts
import { isEnabled } from '../config/features';

if (!isEnabled('myFeature')) return c.json({ error: 'not_found' }, 404, { 'Cache-Control': 'no-store' });
```

```tsx
import { useFeature } from '../shell/useBuild';

const enabled = useFeature('myFeature');
```

While a feature is behind a flag, it must not change what already works when the flag is off. Its migrations still run on stable, so they may only add tables or columns, never change or drop existing ones.

`GET /api/build` reports the version, the channel (`dev`, `nightly` or `stable`, derived from the version) and the enabled flags, and the footer shows the channel (`Dev`, `Nightly`, or `Beta` for `0.x` stable builds; hidden from `1.0.0` on). An operator forces a flag with `SCULK_FEATURES`, a comma-separated list (`name` on, `-name` off). Boot refuses a name that is not in `FEATURES`. Currently `FEATURES` holds `oidcProvider` (`nightly`, [OIDC provider](https://docs.sculk.network/nightly/sculk/oidc-provider.md)) and `sculkworm` (`nightly`, [Sculkworm integration](https://docs.sculk.network/nightly/sculk/sculkworm-integration.md)).

### Labs

The Labs pages do not exist yet. They come with the first `labs` feature, as two pages: one in the account settings for `user` features, and one in each server's settings for `server` features, which the server owner sets for every player. An instance operator's `SCULK_FEATURES` wins over both, and the page shows the switch locked.

## Switch channels on an instance

Set `SCULK_IMAGE` in `.env` to the channel or version, then pull and restart:

| You want | `SCULK_IMAGE` |
| --- | --- |
| Every stable release | `ghcr.io/yellowumbrelladev/sculk.network:latest` |
| Fixes for one line only | `ghcr.io/yellowumbrelladev/sculk.network:0.3` |
| One exact version | `ghcr.io/yellowumbrelladev/sculk.network:0.3.1` |
| Every nightly | `ghcr.io/yellowumbrelladev/sculk.network:nightly` |

Moving from stable to nightly works at any time. Moving back does not: a nightly may have applied migrations that the stable release does not know, and the server refuses to start on a database newer than itself:

```text
Error: migrations: the database has S40-labs.sql, which this version does not know. A newer version migrated it. Run that version or a later one, or restore a backup taken before the upgrade.
```

Wait for the stable release that contains that nightly, or restore the backup you took before the switch.

## One-time setup

These need a repository admin. Do them once.

1. Before the first release, Settings → Environments: create `nightly` and `release`. They need no protection rules: the workflow checks the role of whoever starts a stable release.
2. Once the repository is public, or on a paid plan: protect `main` and `release-*` (require a PR and `ci-ok`), and on the `release` environment add the maintainers as **Required reviewers** and limit **Deployment branches** to `main` and `release-*`. Also restrict **Deployment branches** on the `docs` environment to `main` once the plan allows. Until then the role check stops mistakes, not someone with write access: they can push a branch whose workflow skips the check, as they can with any workflow in the repository.
3. After the first run, open each package on GitHub (Packages → `sculk.network`, `oauthmc`, `sculkworm`) and set its visibility, and under **Manage Actions access** give this repository the **Write** role.
