bots-garden/razorbillpublic Fork
⑂ v1.0.0
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/razorbill.git
git clone ssh://git@rickub.com/bots-garden/razorbill.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
🛟 Updated. 872a940 · on v1.0.0 · k33g · 3h ago
package-a-release.md · 113 lines · 8.4 KBmarkdown
Blame HistoryOpen raw

How to package and publish a release

This guide builds the release of razorbill, signs and notarizes rzb, and publishes it on Rickub, with the local-ci-*.sh scripts at the root of the repository. It assumes you can already build rzb on the Mac. Users install the result with INSTALL.MACOS.md.

Step Script Where
Checks ./local-ci-01-check.sh the Mac (on Linux, MLX is not tested)
Build, sign, notarize ./local-ci-02-build.sh the Mac
Tag and draft prerelease ./local-ci-03-create-draft.sh the Mac or Linux
Upload ./local-ci-04-upload.sh the Mac or Linux
Publish ./local-ci-05-publish.sh the Mac or Linux; asks you to type the tag
Promote (optional) ./local-ci-06-promote.sh the Mac or Linux; asks you to type the tag

Settings (once)

  1. The Rickub token: .ci.cd.token.env at the root, holding CI_TOKEN=…. It is git-ignored; never commit it.

  2. The release settings: .release.env at the root, also git-ignored:

    TAG="v1.0.0"
    ABOUT="razorbill — MLX model server with an OpenAI-compatible API"
    OWNER="bots-garden"
    REPO="razorbill"
    # macOS signature. Empty = rzb is not signed.
    RZB_SIGN_IDENTITY="${SIDEKICKS_SIGN_IDENTITY:-}"
    RZB_NOTARY_PROFILE="${SIDEKICKS_NOTARY_PROFILE:-}"
    

    .release.env is read by bash: it picks up the variables exported in your ~/.zshrc.

  3. The signing identity: security find-identity -v -p codesigning must list "Developer ID Application: … (TEAMID)", exactly the value of RZB_SIGN_IDENTITY. The certificate belongs to the team, not to an application: the one that signs mini-me and Sidekicks signs rzb too. Nothing has to be registered at Apple for rzb; its identifier, com.bots-garden.rzb, is chosen by the script.

  4. The notarization profile: xcrun notarytool history --keychain-profile "$RZB_NOTARY_PROFILE" must list submissions without an authentication error. If the profile is missing: create an app-specific password on account.apple.com, then xcrun notarytool store-credentials <name> --apple-id <you@example.com> --team-id <TEAMID>.

  5. The hardened runtime: notarization requires it. Check that rzb still works under it, with the models of the compatibility suite pulled:

    scripts/check-hardened-runtime.sh
    

    It signs a Release build like the release does (with RZB_SIGN_IDENTITY when set, otherwise ad hoc) and runs scripts/compat.sh against that copy: real chat, streaming, structured output, tools and embeddings. Run it again after an MLX or macOS upgrade. If it fails while scripts/compat.sh alone passes, rzb needs an entitlement: do not publish a signed release before that is solved.

Every release

  1. Prepare the release (version in Sources/RazorbillCore/Razorbill.swift and the docs, release notes release-notes/vX.Y.Z.md and .fr.md, TAG in .release.env): the release skill does it. Commit and push main: step 03 refuses a tree that is not clean or a HEAD that is not the remote's main.

  2. If the repository sits in a synced folder (kDrive, iCloud Drive…), pause the sync during step 02.

  3. On the Mac:

    ./local-ci-01-check.sh
    ./local-ci-02-build.sh
    

    With RZB_SIGN_IDENTITY set, step 02 checks the setup before building (identity in the keychain, working notarytool profile), builds in Release into .build/release, copies rzb and its bundles to a temporary folder, signs the bundles then rzb (--options runtime --timestamp --identifier com.bots-garden.rzb), checks the signature (Developer ID authority, runtime flag, timestamp), sends the folder to Apple in a .zip and waits for Accepted. Then scripts/release.sh --products makes the archive, step 02 unpacks it, checks the signatures again and runs the unpacked rzb --version. You should see:

    🔏 Signing and notarizing rzb and its bundles...
       ✅ rzb signed (Developer ID, hardened runtime, timestamp) and 6 bundles sealed
       ⏳ waiting for Apple's notary service (a few minutes)...
       ✅ notarized (submission 1a2b3c4d-…)
       ✅ signatures intact in the unpacked archive
       ✅ the archived rzb starts and reports 1.0.0
    

    release/<TAG>/ then holds the archive, SHA256SUMS, a README.md and macos-signature.txt (the signature and the notarization submission; not published).

  4. Then:

    ./local-ci-03-create-draft.sh    # the tag v1.0.0 and a draft prerelease
    ./local-ci-04-upload.sh          # the archive and SHA256SUMS
    ./local-ci-05-publish.sh         # public; becomes /releases/latest
    ./local-ci-06-promote.sh         # optional: removes the pre-release label
    

    Step 03 writes the release text from ABOUT, the summary sentence of release-notes/<TAG>.md, the commit, the Xcode version (recorded by step 02), a signature line when macos-signature.txt exists, links to the notes and the install guide, and the checksum. LOCAL_CI_PRINT_NOTES=1 ./local-ci-03-create-draft.sh prints that text and creates nothing.

    Rickub only accepts uploads from a CI job's token, so step 04 pushes a temporary branch holding the archive and a one-job workflow, waits for the job and deletes the branch. Step 05 downloads what is public and compares it with release/<TAG>/.

  5. Try it as a user would: download the archive with a browser, unpack it, and run rzb --version from the folder; no dialog must block it.

A published release cannot take a new archive in place of the old one: Rickub refuses a file name that already exists. Publish a new version instead.

What the archive holds

Entry Role
rzb The executable (Apple Silicon, macOS 14 or later), signed with the hardened runtime.
mlx-swift_Cmlx.bundle The MLX Metal library (default.metallib); without it no model loads.
swift-transformers_Hub.bundle, swift-nio_*.bundle, swift-crypto_Crypto.bundle The other resource bundles of the dependencies. Every *.bundle of the build is copied, and sealed by the signature.
INSTALL.txt Where to put the folder; says whether the archive is signed.
LICENSE The MIT license.

The bundles must stay next to rzb: the folder is installed whole, with a launcher in bin/ (INSTALL.MACOS.md).

Variants

  • Unsigned archive: leave RZB_SIGN_IDENTITY empty. Step 02 warns rzb is not signed and INSTALL.txt gives the xattr command.
  • Archive without the CI: scripts/release.sh builds and packages into dist/ (unsigned). --products <dir> packages an existing build (also from Linux, without the final rzb --version check), --out <dir> writes elsewhere, --allow-dirty accepts uncommitted work (never publish such an archive).

Troubleshooting

Symptom What to do
TAG is v… but Sources/RazorbillCore/Razorbill.swift says … The tag and the compiled version differ: fix one of them (the release skill sets both).
RZB_SIGN_IDENTITY is set but RZB_NOTARY_PROFILE is not Add the profile to .release.env. A signed binary that is not notarized is still blocked by Gatekeeper.
no valid identity "…" in the keychain security find-identity -v -p codesigning, copy the exact value. If it shows CSSMERR_TP_NOT_TRUSTED, install the Developer ID G2 intermediate certificate from apple.com/certificateauthority.
the notarytool profile "…" does not work xcrun notarytool history --keychain-profile "…" gives the error; a revoked app-specific password is made again.
notarization …: Invalid xcrun notarytool log <id> --keychain-profile "$RZB_NOTARY_PROFILE" (the command is printed) gives the reason.
codesign refuses ("resource fork, Finder information, or similar detritus") Metadata from a synced folder. The script clears it with xattr -cr; pause the sync and run step 02 again.
is not writable (left by a run with sudo?) sudo chown -R "$(whoami)" release dist .build, and never run these scripts with sudo.
HEAD (…) is not the remote's main Push main first.

See also

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# How to package and publish a release

This guide builds the release of razorbill, signs and notarizes `rzb`, and publishes it on Rickub, with the `local-ci-*.sh` scripts at the root of the repository. It assumes you can already [build rzb on the Mac](build-on-the-mac.md). Users install the result with [`INSTALL.MACOS.md`](../../../INSTALL.MACOS.md).

| Step | Script | Where |
| --- | --- | --- |
| Checks | `./local-ci-01-check.sh` | the Mac (on Linux, MLX is not tested) |
| Build, sign, notarize | `./local-ci-02-build.sh` | the Mac |
| Tag and draft prerelease | `./local-ci-03-create-draft.sh` | the Mac or Linux |
| Upload | `./local-ci-04-upload.sh` | the Mac or Linux |
| Publish | `./local-ci-05-publish.sh` | the Mac or Linux; asks you to type the tag |
| Promote (optional) | `./local-ci-06-promote.sh` | the Mac or Linux; asks you to type the tag |

## Settings (once)

1. **The Rickub token**: `.ci.cd.token.env` at the root, holding `CI_TOKEN=…`. It is git-ignored; never commit it.
2. **The release settings**: `.release.env` at the root, also git-ignored:

   ```bash
   TAG="v1.0.0"
   ABOUT="razorbill — MLX model server with an OpenAI-compatible API"
   OWNER="bots-garden"
   REPO="razorbill"
   # macOS signature. Empty = rzb is not signed.
   RZB_SIGN_IDENTITY="${SIDEKICKS_SIGN_IDENTITY:-}"
   RZB_NOTARY_PROFILE="${SIDEKICKS_NOTARY_PROFILE:-}"
   ```

   `.release.env` is read by bash: it picks up the variables exported in your `~/.zshrc`.
3. **The signing identity**: `security find-identity -v -p codesigning` must list `"Developer ID Application: … (TEAMID)"`, exactly the value of `RZB_SIGN_IDENTITY`. The certificate belongs to the team, not to an application: the one that signs mini-me and Sidekicks signs rzb too. Nothing has to be registered at Apple for rzb; its identifier, `com.bots-garden.rzb`, is chosen by the script.
4. **The notarization profile**: `xcrun notarytool history --keychain-profile "$RZB_NOTARY_PROFILE"` must list submissions without an authentication error. If the profile is missing: create an app-specific password on [account.apple.com](https://account.apple.com), then `xcrun notarytool store-credentials <name> --apple-id <you@example.com> --team-id <TEAMID>`.
5. **The hardened runtime**: notarization requires it. Check that rzb still works under it, with the models of the compatibility suite pulled:

   ```bash
   scripts/check-hardened-runtime.sh
   ```

   It signs a Release build like the release does (with `RZB_SIGN_IDENTITY` when set, otherwise ad hoc) and runs [`scripts/compat.sh`](run-the-tests.md) against that copy: real chat, streaming, structured output, tools and embeddings. Run it again after an MLX or macOS upgrade. If it fails while `scripts/compat.sh` alone passes, rzb needs an entitlement: do not publish a signed release before that is solved.

## Every release

1. Prepare the release (version in `Sources/RazorbillCore/Razorbill.swift` and the docs, release notes `release-notes/vX.Y.Z.md` and `.fr.md`, `TAG` in `.release.env`): the `release` skill does it. Commit and push `main`: step 03 refuses a tree that is not clean or a `HEAD` that is not the remote's `main`.
2. If the repository sits in a synced folder (kDrive, iCloud Drive…), pause the sync during step 02.
3. On the Mac:

   ```bash
   ./local-ci-01-check.sh
   ./local-ci-02-build.sh
   ```

   With `RZB_SIGN_IDENTITY` set, step 02 checks the setup before building (identity in the keychain, working notarytool profile), builds in Release into `.build/release`, copies `rzb` and its bundles to a temporary folder, signs the bundles then `rzb` (`--options runtime --timestamp --identifier com.bots-garden.rzb`), checks the signature (Developer ID authority, `runtime` flag, timestamp), sends the folder to Apple in a `.zip` and waits for `Accepted`. Then `scripts/release.sh --products` makes the archive, step 02 unpacks it, checks the signatures again and runs the unpacked `rzb --version`. You should see:

   ```
   🔏 Signing and notarizing rzb and its bundles...
      ✅ rzb signed (Developer ID, hardened runtime, timestamp) and 6 bundles sealed
      ⏳ waiting for Apple's notary service (a few minutes)...
      ✅ notarized (submission 1a2b3c4d-…)
      ✅ signatures intact in the unpacked archive
      ✅ the archived rzb starts and reports 1.0.0
   ```

   `release/<TAG>/` then holds the archive, `SHA256SUMS`, a `README.md` and `macos-signature.txt` (the signature and the notarization submission; not published).
4. Then:

   ```bash
   ./local-ci-03-create-draft.sh    # the tag v1.0.0 and a draft prerelease
   ./local-ci-04-upload.sh          # the archive and SHA256SUMS
   ./local-ci-05-publish.sh         # public; becomes /releases/latest
   ./local-ci-06-promote.sh         # optional: removes the pre-release label
   ```

   Step 03 writes the release text from `ABOUT`, the summary sentence of `release-notes/<TAG>.md`, the commit, the Xcode version (recorded by step 02), a signature line when `macos-signature.txt` exists, links to the notes and the install guide, and the checksum. `LOCAL_CI_PRINT_NOTES=1 ./local-ci-03-create-draft.sh` prints that text and creates nothing.

   Rickub only accepts uploads from a CI job's token, so step 04 pushes a temporary branch holding the archive and a one-job workflow, waits for the job and deletes the branch. Step 05 downloads what is public and compares it with `release/<TAG>/`.
5. Try it as a user would: download the archive **with a browser**, unpack it, and run `rzb --version` from the folder; no dialog must block it.

A published release cannot take a new archive in place of the old one: Rickub refuses a file name that already exists. Publish a new version instead.

## What the archive holds

| Entry | Role |
| --- | --- |
| `rzb` | The executable (Apple Silicon, macOS 14 or later), signed with the hardened runtime. |
| `mlx-swift_Cmlx.bundle` | The MLX Metal library (`default.metallib`); without it no model loads. |
| `swift-transformers_Hub.bundle`, `swift-nio_*.bundle`, `swift-crypto_Crypto.bundle` | The other resource bundles of the dependencies. Every `*.bundle` of the build is copied, and sealed by the signature. |
| `INSTALL.txt` | Where to put the folder; says whether the archive is signed. |
| `LICENSE` | The MIT license. |

The bundles must stay next to `rzb`: the folder is installed whole, with a launcher in `bin/` ([`INSTALL.MACOS.md`](../../../INSTALL.MACOS.md)).

## Variants

- **Unsigned archive**: leave `RZB_SIGN_IDENTITY` empty. Step 02 warns `rzb is not signed` and `INSTALL.txt` gives the `xattr` command.
- **Archive without the CI**: `scripts/release.sh` builds and packages into `dist/` (unsigned). `--products <dir>` packages an existing build (also from Linux, without the final `rzb --version` check), `--out <dir>` writes elsewhere, `--allow-dirty` accepts uncommitted work (never publish such an archive).

## Troubleshooting

| Symptom | What to do |
| --- | --- |
| `TAG is v… but Sources/RazorbillCore/Razorbill.swift says …` | The tag and the compiled version differ: fix one of them (the `release` skill sets both). |
| `RZB_SIGN_IDENTITY is set but RZB_NOTARY_PROFILE is not` | Add the profile to `.release.env`. A signed binary that is not notarized is still blocked by Gatekeeper. |
| `no valid identity "…" in the keychain` | `security find-identity -v -p codesigning`, copy the exact value. If it shows `CSSMERR_TP_NOT_TRUSTED`, install the Developer ID G2 intermediate certificate from [apple.com/certificateauthority](https://www.apple.com/certificateauthority/). |
| `the notarytool profile "…" does not work` | `xcrun notarytool history --keychain-profile "…"` gives the error; a revoked app-specific password is made again. |
| `notarization …: Invalid` | `xcrun notarytool log <id> --keychain-profile "$RZB_NOTARY_PROFILE"` (the command is printed) gives the reason. |
| `codesign` refuses ("resource fork, Finder information, or similar detritus") | Metadata from a synced folder. The script clears it with `xattr -cr`; pause the sync and run step 02 again. |
| `is not writable (left by a run with sudo?)` | `sudo chown -R "$(whoami)" release dist .build`, and never run these scripts with sudo. |
| `HEAD (…) is not the remote's main` | Push `main` first. |

## See also

- [Build rzb on the Mac](build-on-the-mac.md)
- [Run the tests](run-the-tests.md), which step 01 runs.
- Apple: [Notarizing macOS software before distribution](https://developer.apple.com/documentation/security/notarizing-macos-software-before-distribution)