This plugin generates default GitHub Actions workflows, documentation templates and configuration files for @alejandrohdezma's Scala libraries repositories.
Add the following line to your plugins.sbt
file:
addSbtPlugin("com.alejandrohdezma" % "sbt-ci" % "2.16.0")
Once the plugin has been installed just execute sbt generateCiFiles
to
automatically add all the documentation, workflows and settings files to the
project. You just need to ensure the sbt generateCiFiles
is executed when
this plugin gets updated in your repository to bring in new changes. If you use
Scala Steward
to keep your repositories up-to-date it is super easy. Just add the following
lines to the .scala-steward.conf
in the root of your repositories:
postUpdateHooks = [
{
command = ["sbt", "generateCiFiles"],
commitMessage = "Run `sbt generateCiFiles`",
groupId = "com.alejandrohdezma",
artifactId = "sbt-ci"
}
]
The library also enables a DocumentationPlugin
on any project enabling the
MdocPlugin
. This plugin adds a bunch of default settings for projects using
mdoc. Specifically it sets so documentation
templates are read from .github/docs
and written to the root directory.
You can exclude certain files by using the excludedFiles
setting:
ThisBuild / excludedFiles += "**/*.md"
.github/docs/LICENSE.md (copied as .github/docs/LICENSE.md)
.github/release.yml (copied as .github/release.yml)
This file contains the template for the "auto-generated release notes"
.github/workflows/ci.yml (copied as .github/workflows/ci.yml)
Runs sbt ci-test
on the project on differnt JDKs (this task should be added to the project as a command alias
containing the necessary steps to compile, check formatters, launch tests...).
Examples of this ci-test
alias can be found here.
It will also do the following:
- It will automatically label PRs based on head branch.
- It will automatically enable auto-merge on
Scala Steward
PRs. You'll need to add aSTEWARD_BOT
repository or organization variable with the name of your scala-steward bot. See https://docs.github.com/en/actions/learn-github-actions/variables.
.github/workflows/release.yml (copied as .github/workflows/release.yml)
This workflow performs two tasks:
-
Creates a release of the project by running
sbt ci-publish
(this task should be added to the project as a command alias containing the necessary steps to do a release). Examples of thisci-publish
alias can be found here. -
Runs
sbt ci-docs
on the project and pushes a commit with the changes (theci-docs
task should be added to the project as a command alias containing the necessary steps to update documentation: re-generate docs files, publish websites, update headers...). Examples of thisci-docs
alias can be found here.
This workflow will launch on pushed tags. Alternatively one can launch it manually using a "workflow dispatch" to create a snapshot release (this won't trigger the documentation update).
.gitignore (copied as .gitignore)
Default .gitignore for the project.
This project is prepared to be used as a template. For a minimum set of changes you just need to:
- Update the list of resources to propagate in
build.sbt
(check forresourcesToPropagate
setting). - Change the
organization
setting to your own inbuild.sbt
. - Release the new plugin to Sonatype or another kind of Maven repository.
README.md
should be auto-updated with the list of new resources once you execute sbt ci-docs
. You can add some descriptions (as comments at the top of the file) to the propagated resources that will then be added to this file. See sbt-propagate docs for more information about what can be done.
alejandrohdezma | juanpedromoreno |