From 6b75c8427e700e7b3e273b42f2b563edf49b11f9 Mon Sep 17 00:00:00 2001 From: Jeff Lewis Date: Fri, 2 Aug 2024 16:20:53 -0600 Subject: [PATCH] update so publish can be called from CI --- .github/workflows/ci.yml | 2 +- build.sc | 20 +++++++++++++++++++- plugins/ci/CiReleaseModules.sc | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d44f51c..5ff7305 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: - name: Publish ${{ github.ref }} if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publishSnapshot == 'true') - run: ./mill -i io.kipp.mill.ci.release.ReleaseModule/publishAll + run: ./mill -i InternalReleaseModule.publishAll env: PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} PGP_SECRET: ${{ secrets.PGP_SECRET }} diff --git a/build.sc b/build.sc index bed2f05..0af0fc4 100644 --- a/build.sc +++ b/build.sc @@ -4,7 +4,7 @@ import $ivy.`io.github.davidgregory084::mill-tpolecat::0.3.5` import $ivy.`com.lewisjkl::header-mill-plugin::0.0.3` import header._ import $file.plugins.ci.CiReleaseModules -import CiReleaseModules.{CiReleaseModule, SonatypeHost} +import CiReleaseModules.{CiReleaseModule, SonatypeHost, ReleaseModule, Discover} import io.github.davidgregory084.TpolecatModule import $ivy.`com.github.lolgab::mill-mima::0.1.1` import com.github.lolgab.mill.mima._ @@ -14,6 +14,24 @@ import mill._ import mill.modules.Jvm import mill.scalalib._ import mill.scalalib.publish._ +import mill.define.ExternalModule +import mill.eval.Evaluator + +object InternalReleaseModule extends Module { + + /** This is a replacement for the mill.scalalib.PublishModule/publishAll task + * that should basically work identically _but_ without requiring the user to + * pass in anything. It also sets up your gpg stuff and grabs the necessary + * env variables to publish to sonatype for you. + */ + def publishAll(ev: Evaluator): Command[Unit] = { + ReleaseModule.publishAll(ev) + } + + import Discover._ + lazy val millDiscover: mill.define.Discover[this.type] = + mill.define.Discover[this.type] +} trait BaseModule extends Module with HeaderModule { def millSourcePath: os.Path = { diff --git a/plugins/ci/CiReleaseModules.sc b/plugins/ci/CiReleaseModules.sc index 1a1aed8..7793d27 100644 --- a/plugins/ci/CiReleaseModules.sc +++ b/plugins/ci/CiReleaseModules.sc @@ -53,7 +53,7 @@ trait CiReleaseModule extends PublishModule { // In here for the Discover import @nowarn("msg=Unused import") -object ReleaseModule extends ExternalModule { +object ReleaseModule extends Module { /** This is a replacement for the mill.scalalib.PublishModule/publishAll task * that should basically work identically _but_ without requiring the user to