Files
materialcraft/docs/releasing.md
T
skylar taylor-barrick 83e7d0112b Use the shared nightly launcher template (#321)
Renders the plain nightly tar's launcher from craft-common-actions' shared template.

Independent check: dylanmtaylor compared all 14 app launcher PRs byte for byte with the template rendered from the registry (https://github.com/storytold/craft-common-actions/pull/367#issuecomment-7172085284); this head was re-checked against craft-common-actions main 88148a5.
2026-11-25 16:17:30 -06:00

14 KiB

Releasing MaterialCraft

The recipe is craftrules' release playbook; this page covers what is specific to MaterialCraft. The pipeline is .github/workflows/release.yml.

Release manager checklist

The steps below are the release manager's; agents never create the release branch, tags or GitHub Releases. The shared runbook with copy-paste gh commands is craftrules release/cut-a-release.md.

1. One-time repository setup (org admin)

Status on 2026-10-23: storytold/materialcraft has the release environment (deployable from release only) and the release ruleset (steps 1 and 2 below). Still to do before the first run: the secrets (step 3) and the runner group (step 4); the release branch is created by the first release push. An org admin runs craftrules release/signing-setup.md steps 1-2 for this repo:

  1. Create the release environment, with deployment branches limited to release.

  2. Add the ruleset on refs/heads/release (restrict creations, updates and deletions, block force pushes; bypass: the release-managers team and the Organization admin role).

  3. Set these environment secrets on release (gh secret set <NAME> --env release -R storytold/materialcraft). Never as org- or repo-level Actions secrets: only the release environment keeps them away from other branches.

    Secret Read by
    APPLE_CERTIFICATE, APPLE_CERTIFICATE_PASSWORD, KEYCHAIN_PASSWORD macOS: Developer ID certificate into a temporary keychain
    APPLE_ID, APPLE_PASSWORD, APPLE_TEAM_ID macOS: notarization (notarytool) and its verification
    AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_SIGNING_ENDPOINT, AZURE_SIGNING_ACCOUNT, AZURE_CERT_PROFILE Windows: Azure Trusted Signing (the org's method)
    WINDOWS_CERTIFICATE, WINDOWS_CERTIFICATE_PASSWORD Windows: a .pfx instead of Azure; takes precedence when set. Leave unset

    Those twelve (APPLE_* and KEYCHAIN_PASSWORD, AZURE_*) are all a signed release needs; GITHUB_TOKEN is provided by Actions.

  4. Add the repo to the org's Default runner group (Settings → Actions → Runner groups). The macOS job (macos-15-xlarge) and the FreeBSD job (github-ubuntu-16core) run on larger runners, which only serve repos in that group; outside it they wait for a runner forever, with no error.

2. Set the version

On main:

cargo xtask version                 # prints the current version
cargo xtask version set 0.2.0       # or 0.2.0-rc.1 for a pre-release

set rewrites [workspace.package] version in the root Cargo.toml (the single source of truth) and refreshes Cargo.lock. Commit, push, and wait for CI on main to pass.

3. Review the release trust boundary, then cut the release

Compare the proposed tree with the previous trusted release, not a manifest from main. Review and preserve:

  • .github/workflows/nightly-sign.yml, .github/nightly-signing-policy.json, and every transitive reusable workflow/action pin;
  • packaging/windows/sign.ps1, its signing configuration, tool installers and imports;
  • the macOS nightly signing scripts (packaging/macos/nightly-sign.sh, nightly-verify.sh, nightly-lib.sh, import-cert.sh) and entitlements, and the Linux public key .github/nightly-linux-signing-key.asc;
  • every other workflow that can reach the release environment, including reusable callees, dynamic environment selection and changed executable dependencies. A new workflow outside the named nightly paths is not exempt.

Stop the sync if that closure is unreviewed. The intended signer-owned files are identical on main and release after promotion; actual top-level repository/event/branch checks and the existing environment restrictions provide authority, not permanent branch divergence. Main CI changes do not need a separate blanket review gate.

Then fast-forward release to the commit that was reviewed and push that commit (only the release-managers team and org admins can). Record the SHA before the review starts: pushing origin/main after a later fetch would promote whatever main became in the meantime, which nobody reviewed.

git fetch origin
reviewed=$(git rev-parse origin/main)   # record this before the review above, at that commit
# ...review the closure above while it is still $reviewed...
git push origin "$reviewed:refs/heads/release"

That push runs release.yml, and also freebsd.yml and windows-arm64.yml (build, test, install checks). A version with a hyphen becomes a pre-release. To test without bumping, dispatch release.yml on release with version set (e.g. 0.2.0-rc.1); a dispatch on any other branch is a dry run (Linux, Flatpak, FreeBSD and web build; the signing jobs are refused by the environment, so no draft is made).

4. Wait for green and verify

RID=$(gh run list -R storytold/materialcraft -w release.yml -L1 --json databaseId --jq '.[0].databaseId')
gh run watch $RID -R storytold/materialcraft
gh run view $RID -R storytold/materialcraft --log | grep -E "status: Accepted|staple and validate action worked|::warning"
  • Every job is green, and no ::warning:: names a missing secret (that platform shipped unsigned: fix the secret and re-run, don't publish).
  • macOS: two The staple and validate action worked! lines (app and DMG) and status: Accepted.
  • The draft MaterialCraft v<version> exists, targets the commit you pushed, and carries every file in the table below plus SHA256SUMS.txt.
  • Download, check and launch at least one artifact per platform:
    • Windows: signtool verify /pa /v materialcraft-<v>-windows-x64.msi succeeds and names the org's publisher; install, open a .mcraft by double-click, materialcraft-cli --version from the install dir, uninstall.
    • macOS: spctl -a -vvv -t install materialcraft-<v>-macos-universal.dmg says Notarized Developer ID; the app opens with no Gatekeeper prompt.
    • Linux: sha256sum -c SHA256SUMS.txt --ignore-missing, then run the AppImage and install the .deb or .rpm; materialcraft --version, materialcraft-cli --version.
    • Web: unzip materialcraft-web-<v>.zip, serve it (python3 -m http.server), open it in a WebGPU browser.

5. Publish

Review the generated notes, then publish the draft (gh release edit v<version> -R storytold/materialcraft --draft=false --latest, or --prerelease for an rc). A draft is updated in place by a re-run; a published release is never overwritten, so bump the version before building again.

Release-ref nightly preparation

The Windows, Linux and macOS source preparation is documented in nightly-release-preparation.md. It is not an activated signing or publication pipeline.

A Nightly build only starts with the Launcher's protocol (--launch-profile nightly-v1 --profile-root <dir> -- files...), and every Linux nightly format starts it that way: the deb/rpm wrapper (/usr/bin/materialcraft-nightly), the AppImage AppRun, the Arch launcher and the Flatpak command use $XDG_DATA_HOME/materialcraft-nightly (the nightly Flatpak uses the same folder inside its own sandbox), so an installed, integrated, extracted or unpacked nightly keeps its autosaves, saved layout and preview cache out of ~/Documents/MaterialCraft and the stable cache. A plain --version (and the Launcher's query form) is passed straight to the binary, which answers it without creating the profile. The plain nightly .tar.gz is the one format whose launcher is not ours: its materialcraft is craft-common-actions' shared template (craft-common-actions #363, rendered for this app), which adds its own profile tokens unless the first argument is already a --launch-profile pair, names the GUI materialcraft-bin beside it and uses $XDG_DATA_HOME/ai.storyteller.materialcraft.nightly, and which asks a bare --version/-V in the Launcher's own form. Stable release.yml, its schedule, tags, concurrency, environment values and environment rules are unchanged.

Initial installation and later signer/policy updates ride an already-intended reviewed stable release sync, with an appropriate version/build state. Every release-branch push may rebuild/update a stable draft or refuse an already-published version. An urgent change that cannot wait means pause/cancel nightlies using existing workflow controls, then request one bounded maintenance push with its exact stable consequences understood. Pausing must never require a release push. Do not bypass CI, overwrite a stable release or make a dummy version bump. Verify the actual environment permits only the release branch, excludes main and same-name tags, and introduces no per-run approval requirement before activation; unresolved protection or secret-scope collisions are blockers, not permission to change settings.

Nightlies share the existing Windows signing identity with stable. A suspected key or signing service compromise therefore affects both channels: stop/cancel nightlies immediately, notify the release maintainers/security owner privately, and have the identity's authorized owner revoke/rotate it and assess already-signed stable and nightly packages. Stopping one workflow does not revoke signatures or make stable safe. No credentials or identity values are recorded in this procedure.

What gets built

All file names are materialcraft-<version>-<platform>-<arch>.<ext>, written to dist/release/.

Platform Artifacts Script
macOS universal (macos-15-xlarge) -macos-universal.dmg (MaterialCraft.app), materialcraft-cli-<version>-macos-universal.zip packaging/macos/package.sh, verify.sh
Windows x64, x86, arm64 -windows-<arch>.msi, -windows-<arch>-portable.zip packaging/windows/package.ps1
Linux x86_64, aarch64 (Ubuntu 22.04, glibc 2.35) .AppImage + .AppImage.zsync, .deb, .rpm, .tar.gz packaging/linux/package.sh
Flatpak x86_64, aarch64 -linux-<arch>.flatpak, repackaged from the Linux tarball packaging/linux/flatpak-bundle.sh
FreeBSD x86_64 (14.3 VM on github-ubuntu-16core) -freebsd-x86_64.tar.gz packaging/freebsd/package.sh
Web materialcraft-web-<version>.zip (trunk, wasm-release profile; hosting notes in packaging/web/README.md) packaging/web/package.sh

Every desktop package ships both binaries, materialcraft and materialcraft-cli (on macOS the CLI is its own zip next to the DMG). Release builds pass the craft-fonts reference (CRAFT_FONTS_REF in release.yml); MaterialCraft does not embed CJK fonts yet (see docs/localization-parity.md). The packaging scripts smoke-test materialcraft-cli --version, and the Linux job also runs the AppImage with --version, so both binaries must print their version and exit without opening a window.

MaterialCraft-specific values

What Value
Bundle / app id ai.storyteller.materialcraft
Package format .mcraft, MIME application/x-materialcraft, UTI ai.storyteller.materialcraft.package (owned). Declared in materialcraft.wxs, Info.plist.in, the .desktop file, mime.xml and the AppStream metainfo: keep all five in step
WiX UpgradeCode 89DE105E-B6C8-4261-ADBE-25BCFA3A0C91, never change it
Flathub manifest packaging/linux/flatpak/ai.storyteller.MaterialCraft.yml (release bundle: …MaterialCraft.bundle.yml)
macOS minimum 11.0 (LSMinimumSystemVersion, MACOSX_DEPLOYMENT_TARGET)

Version and build info in the binaries

apps/materialcraft/build.rs (also include!d by apps/materialcraft-cli/build.rs) sets, for env!:

  • MATERIALCRAFT_BUILD_SHA: the full commit. CI sets it to github.sha; packaging/env.sh sets it from git; otherwise build.rs asks git itself; empty when unknown.
  • MATERIALCRAFT_BUILD_DATE: YYYY-MM-DD (UTC). CI sets it once per run; otherwise today's date, or SOURCE_DATE_EPOCH's for reproducible builds.

On Windows targets it also embeds assets/app-icon/materialcraft.ico and VERSIONINFO (ProductName MaterialCraft); package.ps1 sets MATERIALCRAFT_REQUIRE_WINRES=1 so a release can't ship an exe without them. The version itself is CARGO_PKG_VERSION.

Other environment variables the scripts read: MATERIALCRAFT_VERSION (override the version), DIST, CARGO_TARGET_DIR, MATERIALCRAFT_MAINTAINER (deb/rpm maintainer), MATERIALCRAFT_WASM_MAX_BYTES (web size gate, default 24 MiB), and at run time MATERIALCRAFT_NO_DESKTOP_INTEGRATION=1 (the AppImage's AppRun skips installing its .desktop entry and icons).

Signing

Secrets live only in the release environment and are all optional: a missing one gives an unsigned artifact and a ::warning::, never a failed build.

  • macOS: APPLE_CERTIFICATE, APPLE_CERTIFICATE_PASSWORD, KEYCHAIN_PASSWORD (import into a temporary keychain, packaging/macos/import-cert.sh), then APPLE_ID, APPLE_PASSWORD, APPLE_TEAM_ID for notarytool and stapling. Without them the app is ad-hoc signed.
  • Windows: packaging/windows/sign.ps1 uses a PFX (WINDOWS_CERTIFICATE, WINDOWS_CERTIFICATE_PASSWORD) if set, otherwise Azure Trusted Signing (all six AZURE_*). It signs both exes before WiX and the MSI after.

Icons

assets/app-icon/materialcraft.svg is the engraved rhino (the owner's original drawing, vectorised to three colours, craftrules standards/icon-design.md); materialcraft-small.svg is a lighter trace for the hicolor scalable icon. packaging/icons.sh renders everything else with resvg and cargo xtask ico|icns: the hicolor PNGs (16-512 px) and scalable SVG, materialcraft-1024.png, materialcraft.ico and materialcraft.icns. The outputs are committed; rerun it after changing the artwork and keep ATTRIBUTION.md in step. See assets/app-icon/README.md.

Local checks

  • cargo xtask ci: fmt, clippy, tests, cargo xtask layers, cargo xtask wasm.
  • bash packaging/linux/apprun-test.sh and bash packaging/freebsd/package.sh --dry-run run anywhere with bash.
  • packaging/macos/package.sh --arch aarch64 on a Mac builds an ad-hoc signed DMG.
  • pwsh packaging/windows/package.ps1 -Arch x64 on Windows (needs WiX 5.0.2) builds an unsigned MSI and portable zip. Use PowerShell 7 as CI does: Windows PowerShell 5.1 with redirected output turns cargo's stderr into an error, so there build with cargo first and pass -SkipBuild.
  • .github/workflows/packaging-lint.yml runs actionlint, shellcheck, the PowerShell parser and the desktop/AppStream/Flatpak validators on every change to packaging/ or the workflows.