The AsciidoctorJ EPUB plugin

Minimal example
plugins {
  id 'org.asciidoctor.jvm.epub' version '5.0.0-alpha.1'
}

asciidoc {
  publications {
    main {
      output('asciidoctorj', 'epub')
    }
  }
}

Configuring the output formatter

import org.asciidoctor.gradle.model5.jvm.formatters.AsciidoctorjPdf

asciidoc {
  toolchains {
    aciidoctorj {
      registeredOutputFormatters {
        epub(AsciidoctorjEpub) {
          useVersion('1.2.3') (1)
          chapterLevel = 2 (2)
          stylesDir = '/path/to/styles' (3)
          frontmatterDir = 'src/docs/asciidoc/frontmatter' (4)
        }
      }
    }
  }
}
1 Use a version of asciidoctorj-epub other than the default.
2 Set the chapter level (1-5).
3 Set an alternative style dir.
4 Specify a frontmatter directory.