Developer docs · v2.4.2

Releasing and deploying

The public site is https://canyoncommand.10fold.stream/: the homepage at /, the game at /play/, the changelog at /changelog and the docs at /docs/. It is served by the Cloudflare Worker canyon-command on the Knot Vector account: static assets from dist/, plus worker/index.js for Discord launches, the Discord sign-in swap and the co-op relay (a Room Durable Object). See DISCORD.md. The site is public with no sign-in. The GitHub repository is private.

Each deployment is recorded in docs/release/<tag>/. Release packages are on the private GitHub releases page.

Tag Cloudflare version
Live v2.4.1 b250f55a-54f7-450b-9407-ed4f46ae560d
Rollback target v2.4.0 749998b2-fbb6-4c0e-b9ca-252185f7d344

Asset requests for .html files redirect to extensionless URLs (html_handling: auto-trailing-slash), so /docs/playing.html is served at /docs/playing. Missing paths get 404.html. _redirects sends the game's old addresses (/Substellar.dc.html, /Substellar.dc) to /play/.

01Rules

  • Deploy only when the owner asks. One deploy approval covers the whole release: merge to main, a new version and tag, the GitHub release, and the Cloudflare deployment of that exact build.
  • Never deploy code without a new version and tag. Versions follow Semantic Versioning.
  • Keep the site public: don't add a Cloudflare Access application for the hostname or change shared Access policies. Keep workers_dev and preview_urls off in wrangler.jsonc.
  • Keep the previous Cloudflare version as the rollback target.
  • Keep credentials and tokens out of the repository.

021. Prepare

On a branch from main:

  1. Bump the version in package.json, package-lock.json and GAME_VERSION in game/Substellar.dc.html (npm version <x.y.z> --no-git-tag-version does the first two).
  2. In site/release-notes.json, make sure the top entry is the new version with its title, summary, groups and date; add the same version and date at the top of site/releases.json (move the Play link from the previous release to it). Run node tools/changelog.cjs to regenerate CHANGELOG.md.
  3. npm ci, npm run check, then playtest (see DEVELOPMENT.md).
  4. Merge to main.

032. Build and package

On main at the commit you will tag, with a clean tree:

npm run build

Note the export digest it prints. Package dist/ as release/Substellar-Canyon-Command-v<version>.zip, copy dist/build-manifest.json to release/, and write release/SHA256SUMS for both files. Copy build-manifest.json to docs/release/v<version>/.

043. Tag and publish the release

git tag -a v<version> -m "Canyon Command v<version>"
git push origin main v<version>
node tools/changelog.cjs --notes v<version> > release/notes.md
gh release create v<version> release/*.zip release/build-manifest.json release/SHA256SUMS --title "Canyon Command v<version>" --notes-file release/notes.md

054. Deploy with Wrangler

  1. npx wrangler whoami must show the Knot Vector account. If the session has expired, the owner runs npx wrangler login.
  2. If wrangler.jsonc gained a Durable Object migration since the live version (v2.4.0 added Room), versions upload refuses it: run npx wrangler deploy --message "Canyon Command v<version>; export <digest>" instead, which uploads and promotes in one step, and skip step 3. A version from before a migration cannot be promoted again afterwards, so the first rollback target after v2.4.0 is v2.4.0 itself. Otherwise, stage a version without moving traffic: npx wrangler versions upload --tag v<version> --message "Canyon Command v<version>; export <digest>"
  3. Promote it: npx wrangler versions deploy <version-id>@100% --message "Deploy v<version>; export <digest>" --yes
  4. Verify anonymously: /, /play/, /changelog, /docs/ and a game asset each return 200, /Substellar.dc.html redirects to /play/ with no Access redirect, the X-Canyon-Command-Export header matches the digest, and the bytes match the release.
  5. Record the deployment in docs/release/v<version>/cloudflare-deployment.json (version id, previous version id, rollback target, checks, time) and commit it.

06Roll back

Promote the recorded rollback version and repeat the checks in step 4:

npx wrangler versions deploy <rollback-version-id>@100% --message "Roll back to <tag>: <reason>" --yes

Record the rollback in that release's cloudflare-deployment.json.