Skip to content

Commit

Permalink
Fix workflow_dispatch publish (#106)
Browse files Browse the repository at this point in the history
* Avoid skipping publish in workflow_dispatch

Publish dev version only for `latestMillDevVersion`.
We were not publishing dev versions of mill-mima for every commit
So I'm removing the stable versions of mill from the ones published
with the manual trigger of `workflow_dispatch`.
This way there are not so many versions to choose from in Maven central.

* Fix cross versions to use `: _*`
  • Loading branch information
lolgab authored May 12, 2023
1 parent 6616168 commit d105484
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
distribution: "temurin"
- name: Publish to Maven Central
run: |
if [[ $(git tag --points-at HEAD) != '' ]]; then
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" || $(git tag --points-at HEAD) != '' ]]; then
echo $SONATYPE_PGP_PRIVATE_KEY | base64 --decode > gpg_key
gpg --import --no-tty --batch --yes gpg_key
rm gpg_key
Expand Down
32 changes: 13 additions & 19 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ import com.github.lolgab.mill.mima._
import os.Path
import scala.util.Try

val stableVersions = Seq("0.9.12", "0.10.0", "0.11.0-M8")
val latestMillDevVersion: Option[String] = {
sys.env
.get("GITHUB_EVENT_NAME")
.filter(_ == "workflow_dispatch")
.map(_ => utils.findLatestDevVersion())
.filter(!stableVersions.contains(_))
}

val millVersions = stableVersions ++ latestMillDevVersion
val millBinaryVersions = stableVersions.map(
scalaNativeBinaryVersion
) ++ latestMillDevVersion
val millVersions = latestMillDevVersion match {
case None => Seq("0.9.12", "0.10.0", "0.11.0-M8")
case Some(version) => Seq(version)
}
val itestMillVersions = latestMillDevVersion match {
case None => Seq("0.9.12", "0.10.0", "0.10.12", "0.11.0-M8")
case Some(version) => Seq(version)
}
val millBinaryVersions = millVersions.map(millBinaryVersion)

def millBinaryVersion(millVersion: String) = Some(millVersion) match {
case `latestMillDevVersion` => millVersion
case _ =>
scalaNativeBinaryVersion(
millVersion
)
def millBinaryVersion(millVersion: String) = {
if (latestMillDevVersion.contains(millVersion)) millVersion
else scalaNativeBinaryVersion(millVersion)
}
def millVersion(binaryVersion: String) =
millVersions.find(v => millBinaryVersion(v) == binaryVersion).get
Expand Down Expand Up @@ -94,13 +94,7 @@ object `mill-mima-worker-impl` extends Common {
)
}

object itest
extends Cross[itestCross](
"0.9.12",
"0.10.0",
"0.10.12",
"0.11.0-M8"
)
object itest extends Cross[itestCross](itestMillVersions: _*)
class itestCross(millVersion: String) extends MillIntegrationTestModule {
override def millSourcePath: Path = super.millSourcePath / os.up
def millTestVersion = millVersion
Expand Down

0 comments on commit d105484

Please sign in to comment.