mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-10-28 23:57:17 +09:00
## Description See corresponding [SaaS PR](https://github.com/webstudio-is/webstudio-saas/pull/311) too ## Steps for reproduction Click Publish/Export <img width="363" alt="image" src="https://github.com/user-attachments/assets/fbc1f4e5-3a2c-4bb9-9242-025196f991bc"> Deploy zip to netlify <img width="1710" alt="image" src="https://github.com/user-attachments/assets/daca4ead-6272-4729-8e82-0986301e5c8b"> ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { z } from "zod";
|
|
import { router, procedure } from "./trpc";
|
|
|
|
const PublishInput = z.object({
|
|
// used to load build data from the builder see routes/rest.build.$buildId.ts
|
|
buildId: z.string(),
|
|
builderOrigin: z.string(),
|
|
githubSha: z.string().optional(),
|
|
|
|
destination: z.enum(["saas", "static"]),
|
|
// preview support
|
|
branchName: z.string(),
|
|
// action log helper (not used for deployment, but for action logs readablity)
|
|
projectDomainName: z.string(),
|
|
});
|
|
|
|
const Output = z.discriminatedUnion("success", [
|
|
z.object({
|
|
success: z.literal(true),
|
|
}),
|
|
z.object({
|
|
success: z.literal(false),
|
|
error: z.string(),
|
|
}),
|
|
]);
|
|
|
|
/**
|
|
* This is the ContentManagementService. It is currently used to publish content to a custom domain.
|
|
* In the future, additional methods, such as a 'preview' function, could be added.
|
|
**/
|
|
export const deploymentRouter = router({
|
|
publish: procedure
|
|
.input(PublishInput)
|
|
.output(Output)
|
|
.mutation(async ({ input }) => {
|
|
return {
|
|
success: false,
|
|
error: `Not implemented, use buildId=${input.buildId}`,
|
|
};
|
|
}),
|
|
});
|