Skip to content

Auto-deploy to Puter via structure-preserving SDK script - #9

Merged
tbh-23 merged 1 commit into
mainfrom
ci/deploy-sdk-script
Jul 22, 2026
Merged

Auto-deploy to Puter via structure-preserving SDK script#9
tbh-23 merged 1 commit into
mainfrom
ci/deploy-sdk-script

Conversation

@tbh-23

@tbh-23 tbh-23 commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

Replaces the disabled @heyputer/cli workflow with scripts/deploy-puter.mjs, a Node script using the @heyputer/puter.js SDK directly. Re-enables auto-deploy on push to main.

Why: every prior attempt failed because the CLI flattens the directory tree — src/js/views/dashboard.js landed at /dashboard.js, so index.html loaded but every nested module 404'd. The script writes each file to its full nested path with createMissingParents, which Puter preserves.

How it works:

  • Walks src/ recursively, uploads each file (structure preserved) into a fresh ~/Sites/homestead/release-<stamp> directory.
  • Only after all uploads succeed, atomically re-points the homestead subdomain at the new release (zero downtime — the old release keeps serving until the flip).
  • Prunes old releases, keeping the most recent few.

Validation (done against the live Puter API before committing)

Given this session's history of broken deploys, I verified the whole chain end-to-end rather than trusting docs:

  • Nested fs.write(path, data, {createMissingParents:true}) preserves directory structure exactly.
  • A Puter-hosted subdomain serves a nested module (js/views/probe.js) at HTTP 200 with correct content — the precise failure mode of every previous attempt.
  • The @heyputer/puter.js SDK exposes every method the script calls (init, auth.getUser, fs.write, fs.readdir, fs.delete, hosting.update, hosting.create).
  • Script passes node --check; File/Blob globals exist in Node 20 (CI runtime).

Required before this deploys successfully

A PUTER_AUTH_TOKEN repository secret (currently not set). Get one at puter.com/dashboard → Create token, then add it at Settings → Secrets and variables → Actions → New repository secret, named PUTER_AUTH_TOKEN.

If the secret is missing when this merges, the run fails cleanly at the first line (the script exits before any Puter call) — it will not touch the live site.

🤖 Generated with Claude Code

Replaces the disabled @heyputer/cli workflow. The CLI flattened the
directory tree (nested modules 404'd); this script writes each file to its
full nested path with createMissingParents, uploads into a fresh
release-<stamp> dir, then atomically re-points the subdomain (zero downtime)
and prunes old releases.

Validated end-to-end against the live Puter FS/hosting API before commit:
nested fs.write preserves structure AND a hosted subdomain serves nested
files at 200 — the exact failure mode of every prior attempt. Also confirmed
the @heyputer/puter.js SDK exposes every method the script calls.

Re-enables the push-to-main trigger. Requires a PUTER_AUTH_TOKEN repo secret.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@tbh-23
tbh-23 merged commit 3c504bb into main Jul 22, 2026
1 check failed
@tbh-23
tbh-23 deleted the ci/deploy-sdk-script branch August 3, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant