diff options
Diffstat (limited to '.ci/ci.ts')
| -rw-r--r-- | .ci/ci.ts | 28 |
1 files changed, 25 insertions, 3 deletions
@@ -1,14 +1,27 @@ #!/usr/bin/env node -import { BuildDockerImageJob, DefaultGitHookPipelineBuilder } from "@emprespresso/ci_model"; +import { BuildDockerImageJob, CoolifyWebhookJob, DefaultGitHookPipelineBuilder } from "@emprespresso/ci_model"; const REGISTRY = "img.liz.coffee"; const NAMESPACE = "emprespresso"; const IMG = "rookery"; +/** Coolify deploy hooks: `release` is the public download site, `main` is the beta one. Other branches only build. */ +const getReleaseDeployment = (branch: string) => { + switch (branch) { + case "release": + return "https://plane.liz.coffee/api/v1/deploy?uuid=vzhqmprh2hqbjjcqrzxwkzww&force=false"; + case "main": + return "https://plane.liz.coffee/api/v1/deploy?uuid=0hgnqywenjjcfltl6hoxmro0&force=false"; + default: + return null; + } +}; + /** - * Every push: build the Dockerfile's `rookery` target, which runs the whole test suite - * (`gradlew check`) and packages the desktop app. A failing test fails the image build. + * Every push builds the Dockerfile's `rookery` target: the test suite runs, the apps are built, and the + * result is a small web server with a download page (a failing test fails the image build). Pushes to + * `main` and `release` then tell Coolify to pull the new image. */ const getPipeline = () => { const gitHookPipeline = new DefaultGitHookPipelineBuilder(); @@ -30,6 +43,15 @@ const getPipeline = () => { }; gitHookPipeline.addStage({ parallelJobs: [build] }); + const webhookUrl = getReleaseDeployment(branch); + if (webhookUrl === null) return gitHookPipeline.build(); + + const deploy: CoolifyWebhookJob = { + type: "coolify_webhook.js", + arguments: { webhookUrl }, + }; + gitHookPipeline.addStage({ parallelJobs: [deploy] }); + return gitHookPipeline.build(); }; |
