railwayUp
uses node:fs
Upload a directory to a service of the linked Railway project, which builds and deploys it.
import { sh } from "#codebase/tcmts/dev"; import fs from "node:fs"; import path from "node:path"; export function railwayUp( stage: string, service: string, { project, environment }: { project: string; environment: string }, good: string, ): void { const up = sh( "railway", [ "up", "--project", project, "--environment", environment, "--service", service, "--detach", "--yes", ], stage, ); console.log(up.out.trim()); if (up.ok) console.log( `deploying the known-good tcm to ${service}: ${fs.readFileSync(path.join(good, "VERIFIED"), "utf8").trim()}`, ); process.exitCode = up.ok ? 0 : 1; }