Auto-deploy to Puter via structure-preserving SDK script - #9
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the disabled
@heyputer/cliworkflow withscripts/deploy-puter.mjs, a Node script using the@heyputer/puter.jsSDK directly. Re-enables auto-deploy on push tomain.Why: every prior attempt failed because the CLI flattens the directory tree —
src/js/views/dashboard.jslanded at/dashboard.js, soindex.htmlloaded but every nested module 404'd. The script writes each file to its full nested path withcreateMissingParents, which Puter preserves.How it works:
src/recursively, uploads each file (structure preserved) into a fresh~/Sites/homestead/release-<stamp>directory.homesteadsubdomain at the new release (zero downtime — the old release keeps serving until the flip).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:
fs.write(path, data, {createMissingParents:true})preserves directory structure exactly.js/views/probe.js) at HTTP 200 with correct content — the precise failure mode of every previous attempt.@heyputer/puter.jsSDK exposes every method the script calls (init,auth.getUser,fs.write,fs.readdir,fs.delete,hosting.update,hosting.create).node --check;File/Blobglobals exist in Node 20 (CI runtime).Required before this deploys successfully
A
PUTER_AUTH_TOKENrepository secret (currently not set). Get one atputer.com/dashboard→ Create token, then add it at Settings → Secrets and variables → Actions → New repository secret, namedPUTER_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