Files

18 KiB
Raw Permalink Blame History

name, description, platforms, version, author, metadata
name description platforms version author metadata
release Cut a Museion release: bump, notes, rail, DMG, tag, publish.
macos
0.3.0 Hermes
hermes
tags
Release
Museion
Xcode
Notarization
Gitea
apex
Micro.blog
BuyMeACoffee

Cutting a Museion release

Runs a release end to end: refresh the bundled apex renderer, version bump, changelog heading, release notes, the verify rail, sliced commits, an annotated tag, the notarized DMG from scripts/release.sh, then push and the Gitea release, then the announcements — Micro.blog and Buy Me a Coffee — each left as a draft for Alexander to publish. The skill decides nothing about signing — release.sh and the Account Holder's keychain do that — and it bumps no version on its own. Push and the forge release wait for Alexander's explicit go (root AGENTS.md, User Preferences); neither announcement is ever published by the agent.

When to Use

  • "cut / ship / tag / bump a release", "make a DMG", "X.Y.Z is ready"
  • notarization came back Invalid, or a bundled binary changed (Museion/Resources/apex) — rerun steps 6–9 and move the still-local tag
  • release notes or the README have to match what shipped

Prerequisites

  • Clean tree on main. MARKETING_VERSION is the only version source; read it from build settings, never from the pbxproj text.
  • A valid Developer ID Application identity: security find-identity -v -p codesigning. When it is missing, the fix is Alexander's (developer.apple.com + a Keychain Access CSR — the scripts/release.sh header has the route); the agent imports nothing.
  • Notary profile museion-notary, registered once by the Account Holder. The agent never runs notarytool store-credentials.
  • tea logged in to git.babylondreams.de (the default login).
  • Micro.blog announcement token in the login keychain: security find-generic-password -a micro.blog -s com.babylondreams.Museion.release-announce -w prints it (step 11 has the one-time add-generic-password). When missing, Alexander generates an App Token (Micro.blog → Account → App Tokens) and the agent stores it — never the other way around.
  • Ego Browser running and logged in to Buy Me a Coffee — buymeacoffee-post has the one-time check.
  • Budget: ~2 min for release.sh, ~7 min for the rail.

Procedure

Run through the terminal tool. Each step ends on a check; the next starts when it passes.

  1. Refresh apex FIRST — every release, no "is it current?" gate. The bundled renderer is stale by definition between releases; the upgrade is the first step, never a comparison that can be skipped. Both sources are the same official binary; pick one:

    GitHub release (canonical):

    W=$(mktemp -d) && cd "$W"
    curl -fsSL https://api.github.com/repos/ApexMarkdown/apex/releases/latest -o rel.json
    TAG=$(python3 -c 'import json;print(json.load(open("rel.json"))["tag_name"])')   # v1.1.NN
    V=${TAG#v}
    curl -fsSLO "https://github.com/ApexMarkdown/apex/releases/download/$TAG/apex-$V-macos-universal.tar.gz"{,.sha256}
    awk '{print $1}' apex-$V-macos-universal.tar.gz.sha256 | shasum -a 256 -c -   # must print OK — stop otherwise
    tar xzf apex-$V-macos-universal.tar.gz
    SRC=apex-$V-macos-universal/apex
    

    Homebrew (fallback only — the formula lags GitHub by days; on 0.1.1's cut day it still carried 1.1.58):

    brew update && brew upgrade apex
    SRC=$(brew --prefix)/bin/apex          # a symlink; lipo reads through it
    

    Either way lipo -info "$SRC" must list arm64 (GitHub ships x86_64+arm64; Homebrew on Apple Silicon is arm64-only — lipo -thin still works on a thin file).

    Then the one recipe (ADR-0011 — 1.1.59 still links libyaml dynamically; the vendored libyaml.bundle stays):

    cd <repo root>
    SIGNER="Developer ID Application: Alexander Kucera (3M7APDAAC5)"
    lipo "$SRC" -thin arm64 -output "$W/apex-arm64"
    # strip EVERY rpath the binary carries — list them first and delete each one; a Homebrew build carries $(brew --prefix)/lib instead of the CI paths
    otool -l "$W/apex-arm64" | grep -A2 LC_RPATH | grep path
    for r in /Users/runner/work/apex/apex/deps/libyaml-universal/lib /usr/local/lib /opt/homebrew/lib "$(brew --prefix)/lib"; do
      install_name_tool -delete_rpath "$r" "$W/apex-arm64" 2>/dev/null || true   # absent paths are fine to skip; the Done-check catches a survivor
    done
    install_name_tool -add_rpath '@executable_path/../Resources/libyaml.bundle' "$W/apex-arm64"
    codesign -f -s "$SIGNER" --options runtime --timestamp "$W/apex-arm64"
    # PROVE it in the shipped layout before it touches the tree
    mkdir -p "$W/proof/Resources/libyaml.bundle" && cp "$W/apex-arm64" "$W/proof/Resources/apex" \
      && cp Museion/Resources/libyaml.bundle/libyaml-0.2.dylib "$W/proof/Resources/libyaml.bundle/"
    "$W/proof/Resources/apex" --version
    printf -- '- a\n\n1. one\n' | "$W/proof/Resources/apex" --no-mixed-lists   # two lists, <ul> then <ol> — never one merged <ul>
    cp "$W/apex-arm64" Museion/Resources/apex
    

    Bump ## apex X.Y.Z + the vX.Y.Z prose in Museion/Resources/THIRD-PARTY-NOTICES.md; add a ### Changed → - **reading:** line under the release heading in CHANGELOG.md. Done when otool -l Museion/Resources/apex | grep -A2 LC_RPATH | grep path prints exactly @executable_path/../Resources/libyaml.bundle, codesign -dvv shows flags=0x10000(runtime) + the Developer ID authority, Museion/Resources/apex --version prints the new version, and --no-mixed-lists appears in --help (ADR-0011's load-bearing flag). If a future apex links libyaml statically (asked upstream), drop the rpath/codesign dylib steps and the .bundle, and update this skill. An upgrade found after tagging costs a second rail run and a second notarization.

  2. Bump. Patch for a bug-fix cut (X.Y.0 → X.Y.1), minor for a feature cut (X.Y.1 → X.Y+1.0) — MARKETING_VERSION on every target and configuration in Museion.xcodeproj/project.pbxproj; CURRENT_PROJECT_VERSION stays. Read back: xcodebuild -project Museion.xcodeproj -scheme Museion -configuration Release -destination 'platform=macOS,arch=arm64' -showBuildSettings | awk -F'= ' '/MARKETING_VERSION = /'. Done when it prints the new version.

  3. Changelog heading. ## [X.Y.Z] - YYYY-MM-DD over the former [Unreleased] entries, a fresh empty [Unreleased] above, one pointer line to the notes (CHANGELOG.md follows Common Changelog). Done when every entry since the last tag sits under the heading.

  4. Release notes — docs/releases/X.Y.Z.md, the CHANGELOG section distilled for humans: what is in it (grouped highlights), the milestones it closes, install, known limits, numbers. Shape precedent: docs/releases/0.1.0.md. Written from the shipped surface — every claim traces to a CHANGELOG entry or to source.

  5. README matches what shipped: install copy, requirements, license pointer; the minimum macOS from MACOSX_DEPLOYMENT_TARGET, never from prose.

  6. Verify rail on the tree you will tag. ./scripts/full-test.sh start, poll ./scripts/full-test.sh status (exit 3 = live), counts from ./scripts/full-test.sh summary. Done when executed == passed == the baseline and the run directory is newer than the last edit. Then swiftformat . && swiftlint . clean, and shellcheck scripts/release.sh when the script changed.

  7. Commit in slices, then tag. docs(readme) · build(release) (tooling + notes + DOX) · chore(release) (bump + changelog heading) · later fixes as fix(scope). Plain prose bodies, no trailers. Tag: git tag -a vX.Y.Z -m "Museion X.Y.Z — <one line>" on the commit whose tree the DMG is built from. A fix found after tagging: commit it, then git tag -f vX.Y.Z <fix commit> while the tag is still local. Done when git describe --tags --exact-match HEAD prints the tag and the tree is clean.

  8. Build and prove the DMG. ./scripts/release.sh — refuses without the identity, reads the version from build settings, writes dist/Museion-X.Y.Z.dmg, and ends with spctl → accepted, source=Notarized Developer ID. Then mount the image and run Contents/Resources/apex --version from it, xcrun stapler validate dist/Museion-X.Y.Z.dmg, and record shasum -a 256 dist/Museion-X.Y.Z.dmg. Done when all four pass and the sha256 is in the report.

  9. Handoff gate. Report the tag commit, the sha256, and what changed. Push and the forge release happen on Alexander's go.

  10. On go — push, release, verify.

    git push origin main vX.Y.Z
    { cat docs/releases/X.Y.Z.md; printf '\n\n[Generated by AI]\n'; } > "$TMPDIR/notes.md"   # house rule: the AI marker closes every tea body
    tea releases create --tag vX.Y.Z --target <tag-commit-sha> -t "Museion X.Y.Z" -f "$TMPDIR/notes.md" -a ./dist/Museion-X.Y.Z.dmg
    tea api '/repos/{owner}/{repo}/releases/tags/vX.Y.Z'
    

    Done when the API shows draft: false, one asset at the local byte size, and a token-authenticated download of the asset sha256-matches the local file.

  11. Micro.blog announcement — a DRAFT, never a publish. The post goes to Micro.blog as post-status: draft so Alexander reviews and publishes it himself (the preview link lands in the report). Token: a Micro.blog App Token (Account → App Tokens) stored ONCE in the login keychain under its own service — never the app's production slot (com.babylondreams.Museion.micropub, account micro.blog — that is the app's live credential, see MuseionTests/AGENTS.md), never a file in the repo:

    security add-generic-password -U -a micro.blog -s com.babylondreams.Museion.release-announce -w '<app token>' </dev/null
    

    (The </dev/null is load-bearing: without it security prompts for a retype.) Then:

    TOK=$(security find-generic-password -a micro.blog -s com.babylondreams.Museion.release-announce -w)
    curl -sS -H "Authorization: Bearer $TOK" 'https://micro.blog/micropub?q=config'      # read destinations + channels
    

    mp-destination is mandatory on this account: q=config lists three microblogs and microblog-default is false on every one, so a post without it is ambiguous. The main blog is https://AlexKucera.micro.blog/ (name alexanderkucera.com); the other two are a tweets cross-post and a test blog. Article posts take mp-channel: default (the channels list: default = Posts, pages = Pages). Post:

    python3 - "$TOK" <<'PY'
    import json, sys, urllib.request
    tok = sys.argv[1]
    payload = {"type": ["h-entry"], "properties": {
      "name": ["Museion X.Y.Z"],
      "content": ["<the announcement, markdown>"],
      "post-status": ["draft"],
      "mp-destination": ["https://AlexKucera.micro.blog/"],
      "mp-channel": ["default"]}}
    req = urllib.request.Request("https://micro.blog/micropub", data=json.dumps(payload).encode(),
          headers={"Authorization": f"Bearer {tok}", "Content-Type": "application/json"}, method="POST")
    with urllib.request.urlopen(req, timeout=30) as r:
        print(r.status, r.headers.get("Location"), r.read().decode())
    PY
    

    Body: docs/releases/X.Y.Z.md is too long for a microblog post — distill it to a short announcement (what was fixed in plain words, the download link, the release-page link, "Developer ID signed and notarized"). A draft does NOT syndicate, so the syndicate-to targets in q=config (Mastodon/Bluesky/Threads) are not touched until Alexander publishes. Read back before reporting: GET '/micropub?q=source&url=<Location>' must show post-status: draft and the content intact — a 2xx alone is not a result. Done when the read-back says draft and the report carries the url (the post's final address) and the preview link. preview is display-only — never the publish/update target. A token pasted into chat is in the transcript: recommend rotation after the run.

  12. Buy Me a Coffee announcement — a DRAFT, never a publish. The step-11 announcement as a BMC post, left for Alexander to publish. The mechanics (Ego Browser, the scripts/bmc.js driver, selectors, pitfalls) live in the buymeacoffee-post skill; the release only fixes the INPUT:

    action: "create", mode: "draft", audience: "public",
    title: "Museion X.Y.Z",
    html: <the step-11 announcement as HTML>,
    

    Done when RESULT.mode is "draft" and RESULT.editUrl is a https://buymeacoffee.com/posts/<id>/edit URL — the script prints null when the drafts list does not show the row, and that is not done. The edit URL goes in the report beside the Micro.blog preview link.

  13. Session log + DOX. write-log for the release; the devlog commit follows the tag (the log is the record about the release, not part of it). DOX pass: root AGENTS.md (commands block, scripts index, session-log window) and docs/AGENTS.md. The log commit rides the next go.

Quick Reference

  • apex: GitHub releases/latest → .sha256 → lipo -thin arm64 -output → strip ALL rpaths → add @executable_path/../Resources/libyaml.bundle → codesign --options runtime → prove in a scratch Resources/ layout → copy into Museion/Resources/apex + bump THIRD-PARTY-NOTICES.md. Every release, first. (Homebrew lags GitHub — fallback only.)
  • Version: xcodebuild -showBuildSettings … | awk '/MARKETING_VERSION = /'
  • Rail: ./scripts/full-test.sh start · status · summary
  • Lint: swiftformat . && swiftlint .
  • Tag: git tag -a vX.Y.Z -m "Museion X.Y.Z — <one line>" · move while local: git tag -f vX.Y.Z <sha>
  • DMG: ./scripts/release.sh → dist/Museion-X.Y.Z.dmg (NOTARIZE=0 skips notarize + staple)
  • Gatekeeper: spctl -a -t open --context context:primary-signature -v dist/Museion-X.Y.Z.dmg
  • Push: git push origin main vX.Y.Z
  • Release: tea releases create --tag vX.Y.Z --target <sha> -t "Museion X.Y.Z" -f <notes> -a ./dist/Museion-X.Y.Z.dmg
  • Read back: tea api '/repos/{owner}/{repo}/releases/tags/vX.Y.Z' (Gitea spells it tag_name, not tag)
  • Micro.blog: POST https://micro.blog/micropub JSON h-entry + post-status: draft + mp-destination (mandatory — no default blog) + mp-channel: default → 202 + Location; read back q=source&url=… → post-status: draft. Token: Keychain service com.babylondreams.Museion.release-announce. Never publish.
  • Buy Me a Coffee: buymeacoffee-post → create + mode: "draft" + audience: "public" → RESULT.editUrl into the report. Never publish.

Pitfalls

  • release.sh packages whatever MARKETING_VERSION says, from the current tree — it bumps and tags nothing.
  • The old "compare --version, upgrade if stale" step read as optional and got skipped by habit — the refresh is unconditional. A brew upgrade apex that prints "already up-to-date" proves nothing: the formula can trail the GitHub release by days (it did on the 0.1.1 cut). GitHub releases/latest is the version of record.
  • install_name_tool -delete_rpath fails loudly on a path the binary does not carry — list the rpaths with otool -l first and delete exactly those; the Homebrew build carries $(brew --prefix)/lib, the GitHub build the three CI/Homebrew paths. The Done-check (exactly ONE rpath left) catches a survivor before the rail, where release.sh would only catch a missing dylib.
  • A cp over the signed Resources/apex must happen AFTER the scratch-layout proof — a binary that fails --no-mixed-lists in scratch has already touched nothing.
  • A green full-test.sh status read right after a resource-only edit can be the PREVIOUS run's summary. Compare run-directory timestamps; zero SwiftCompile lines is normal then, and freshness is the CpResource line for the changed file plus running it from the test host's built bundle.
  • A DMG built before the last binary or script change is stale: rebuild, re-notarize, and the sha256 in the report is the one that ships.
  • The tag moves only while local; after the push a fix is a new version.
  • tea releases create takes the tag via --tag OR the positional — both is "ambiguous arguments". @file bodies work only on tea api; releases take -f <file>.
  • The release asset download 404s without a token (private repo). Read the token from ~/Library/Application Support/tea/config.yml into a shell variable for the curl — never print it. grep -E '^\s*token:' + sed is enough; PyYAML is not installed on the system python.
  • tea releases create prints NOTHING on success (exit 0, empty output). The tea api read-back is the only proof — and Gitea's release JSON has tag_name, not GitHub's tag.
  • security add-generic-password -w <value> without </dev/null prompts for a retype and fails with "passwords don't match" when stdin is not a tty; the item is NOT stored and the next read returns 0 chars. Always </dev/null, always read the length back.
  • A Micro.blog post without mp-destination is a gamble on this account — q=config shows three microblogs and none is microblog-default. Read q=config before every announcement; the destination set can change.
  • q=source&url=… read-back does not echo mp-destination or mp-channel; the post's Location host (alexanderkucera.com) is the evidence the destination took.
  • core.hooksPath=scripts/hooks: the pre-push hook is the lint gate; the rail is yours to run before tagging.
  • A dylib dropped into a synced Resources folder gets linked into the app by Xcode's classifier; vendored libraries ride a .bundle folder (ADR-0011).

Verification

tea api '/repos/{owner}/{repo}/releases/tags/vX.Y.Z' → draft: false, one asset whose downloaded sha256 equals shasum -a 256 dist/Museion-X.Y.Z.dmg; spctl -a -t open --context context:primary-signature -v dist/Museion-X.Y.Z.dmg → accepted, source=Notarized Developer ID. Micro.blog: GET https://micro.blog/micropub?q=source&url=<Location> → post-status: draft, content intact. Buy Me a Coffee: RESULT.mode: "draft" + RESULT.editUrl in the report. Both drafts sit in Alexander's queues awaiting his publish.