diff options
| author | Elizabeth Hunt <me@liz.coffee> | 2026-01-01 17:43:55 -0800 |
|---|---|---|
| committer | Elizabeth Hunt <me@liz.coffee> | 2026-01-01 17:43:55 -0800 |
| commit | 0248a3899ed910f005dccaeefc1d9dcb893e8154 (patch) | |
| tree | c9047ebc0249544c66090afcbfdb8c5eee4fc0c8 /.ci/ci.ts | |
| parent | 4270290976290350bd8dee11ec7e36a8e3ed6b9a (diff) | |
| download | mistymountainstherapy-master.tar.gz mistymountainstherapy-master.zip | |
Add cimaster
Diffstat (limited to '.ci/ci.ts')
| -rw-r--r-- | .ci/ci.ts | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/.ci/ci.ts b/.ci/ci.ts new file mode 100644 index 0000000..ad0c7be --- /dev/null +++ b/.ci/ci.ts @@ -0,0 +1,77 @@ +#!/usr/bin/env node + +import { + AnsiblePlaybookJob, + BuildDockerImageJob, + DefaultGitHookPipelineBuilder, + NpmPublishJob, + FetchCodeJob, + CoolifyWebhookJob, + Job, +} from "@emprespresso/ci_model"; +import { join } from "path"; + +const REGISTRY = "img.liz.coffee"; +const NAMESPACE = "emprespresso"; +const IMG = "mmt"; +const REMOTE = "https://code.liz.coffee"; + +const getPipeline = () => { + const gitHookPipeline = new DefaultGitHookPipelineBuilder(); + const branch = gitHookPipeline.getBranch(); + if (!branch) return gitHookPipeline.build(); + + const commonBuildArgs = { + context: gitHookPipeline.getSourceDestination(), + registry: REGISTRY, + namespace: NAMESPACE, + imageTag: branch, + }; + + const mmtPackageBuild: BuildDockerImageJob = { + type: "build_docker_image.js", + arguments: { + ...commonBuildArgs, + repository: IMG, + buildTarget: IMG, + dockerfile: "Dockerfile", + }, + }; + gitHookPipeline.addStage({ + parallelJobs: [mmtPackageBuild], + }); + + const webhookUrl = getReleaseDeployment(branch); + if (webhookUrl === null) { + return gitHookPipeline.build(); + } + + const release: CoolifyWebhookJob = { + type: "coolify_webhook.js", + arguments: { + webhookUrl: webhookUrl!!, + }, + }; + gitHookPipeline.addStage({ parallelJobs: [release] }); + + return gitHookPipeline.build(); +}; + +const getReleaseDeployment = (branch: string) => { + switch (branch) { + case "release": + return "https://plane.liz.coffee/api/v1/deploy?uuid=f40gwg0gg4s4c000ws0s08s8&force=false"; + case "main": + return "https://plane.liz.coffee/api/v1/deploy?uuid=gcw80ssgwg80ogs0sc4k0ww0&force=false"; + default: + return null; + } +}; + +const main = () => { + const data = getPipeline().serialize(); + process.stdout.write(data); +}; + +main(); + |
