taig / sbt-blowout

sbt plugin for generating configuration files

Version Matrix

sbt blowout

CI & CD sbt-blowout-core Scala version support

sbt plugin for generating configuration files

Installation

addSbtPlugin("io.taig" % "sbt-blowout-core" % "[version]")
addSbtPlugin("io.taig" % "sbt-blowout-json" % "[version]")
addSbtPlugin("io.taig" % "sbt-blowout-yaml" % "[version]")

Quickstart

  1. Register generators

    blowoutGenerators += BlowoutGenerator.strict(
      file("my-config.yml"),
      content = s"""version: ${scalaVersion.value}""".stripMargin
    )
  2. Install generators via sbt

    sbt blowoutGenerate
  3. Commit and push generated files, ideally verifying in your CI that your sbt-blowout installations are up to date

    sbt blowoutCheck

Guide

sbt-blowout generates configuration files of arbitrary formats and extensions with the sbt-blowout-core module. Other modules (like sbt-blowout-yaml) provide additional helpers on top of that to ease generation of specific file formats. sbt-blowout can be useful to generate CI configurations (such as GitHub Action workflows), Dockerfiles, cloud deployment configurations or any other configuration file that can benefit from access to the sbt build configuration.

YAML

The YAML module uses circe-yaml in order to provide the convenient circe JSON builders before converting the AST to YAML.

blowoutGenerators += BlowoutYamlGenerator.strict(
   file("my-config.yml"),
   content = Json.obj("version" := scalaVersion.value)
)

JSON

The JSON module uses circe in order to provide the convenient circe JSON builders.

blowoutGenerators += BlowoutJsonGenerator.strict(
   file("my-config.json"),
   content = Json.obj("version" := scalaVersion.value)
)

Acknowledgements

This plugin is highly inspired by sbt-github-actions which provides a very similar workflow, but is limited to generating GitHub Actions workflow configuration files.