An opinionated Giter8 template for For Mill plugins.
This template is meant to get you up and running quickly when wanting to make a Mill plugin, test it, have CI for it (on GitHub), and release it (Maven Central). It's basically the setup I personally use and got annoyed creating it from scratch each time. This template includes the following:
- mill-scalafix for running Scalafix rules like organize imports against your code.
- Scalafmt module configured to be able to format your code.
- Publish module configured to be able to publish your plugin.
- mill-ci-release configured to automatically publish snapshots and releases, plus to take care of versioning.
- mill-integrationtest configured to start testing your plugin right away.
- GitHub workflow set up for checking formatting, linting, testing, and publishing.
- Release Drafer set up to help with release notes.
- Dependabot set up to send in prs to keep your actions up to date.
- mill-dependency-submission set up to submit your dependency tree to GitHub in order to get alerts about vulnerabilities.
NOTE: By default this template sets your license as Apache 2.0. If you don't want this you'll need to update your LICENSE file.
You can use this template to generate a new project with g8 or with Mill.
Usage with g8
g8 ckipp01/mill-plugin.g8
Usage with Mill
mill -i init ckipp01/mill-plugin.g8
Once your've created your project you should be able to cd
into it and get
started! The project is already set up to have a working integration test
executable with mill itest
to give you an example.
NOTE: Because this is using mill-ci-release
and therefore
mill-vcs-version
it expects your workspace to be a git repository. You'll need
to do a git init
prior to running mill itest
or you'll see a failure about
your workspace not being a git repository.
When you're ready to publish your plugin the GitHub workflow is already present
in the release.yml
. However, it expects a few things to be set up before
publishing. It will need the following 4 secrets added to your
repository:
PGP_SECRET
(base64 encoded)PGP_PASSPHRASE
SONATYPE_USERNAME
SONATYPE_PASSWORD
If you're unfamiliar with publishing process to Maven Central you can read a bit more about it in the mill-ci-release README and also here on the Scala Website which explains a bit more about how to get an account set up and keys created. Note that the examples use sbt, so ignore the build-tool specific stuff and focus on the steps up to that point.