/fluent-gitlab-ci

Generate GitLab CI configuration file (.gitlab-ci.yml) from a simple declarative syntax in typescript 🛠️ 💻 ✨

Primary LanguageTypeScriptMIT LicenseMIT

Fluent GitLab CI

deno module deno compatibility

Fluent GitLab CI is a deno module for generating GitLab CI configuration files easily and fluently.

🚀 Usage

import { GitlabCI, Job } from "https://deno.land/x/fluent_gitlab_ci/mod.ts";

const build = new Job().stage("build").script(`
  echo "Compiling the code..."
  echo "Compile complete."
`);

const unitTest = new Job().stage("test").script(`
  echo "Running unit tests... This will take about 60 seconds."
  sleep 60
  echo "Code coverage is 90%"
`);

const lint = new Job().stage("test").script(`
  echo "Linting code... This will take about 10 seconds."
  sleep 10
  echo "No lint issues found."
`);

const deploy = new Job().stage("deploy").script(`
  echo "Deploying application..."
  echo "Application successfully deployed."
`);

const gitlabci = new GitlabCI()
  .stages(["build", "test", "deploy"])
  .addJob("build-job", build)
  .addJob("unit-test-job", unitTest)
  .addJob("lint-test-job", lint)
  .addJob("deploy-job", deploy);

console.log(gitlabci.toString());

gitlabci.write();

See examples for more details.