From 540194468673c8cad4cd9bfdfa4689d29fa3521b Mon Sep 17 00:00:00 2001 From: Milad Khajavi Date: Thu, 5 Jan 2023 16:17:47 +0330 Subject: [PATCH] Fix Artifact Version For Javadoc Badge (#78) --- README.md | 4 ++-- docs/developer-notes.md | 2 ++ .../src/main/scala/zio/sbt/WebsitePlugin.scala | 9 ++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9902f03b..35e90896 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,14 @@ _ZIO SBT_ is an sbt plugin for ZIO projects. It provides high-level SBT utilities that simplify the development of ZIO applications. -[![Production Ready](https://img.shields.io/badge/Project%20Stage-Production%20Ready-brightgreen.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-sbt/workflows/CI/badge.svg) [![Sonatype Releases](https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-sbt-website_2.12.svg?label=Sonatype%20Release)](https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-sbt-website_2.12/) [![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-sbt-website_2.12.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-sbt-website_2.12/) [![javadoc](https://javadoc.io/badge2/dev.zio/zio-sbt-docs/javadoc.svg)](https://javadoc.io/doc/dev.zio/zio-sbt-docs) [![ZIO SBT](https://img.shields.io/github/stars/zio/zio-sbt?style=social)](https://github.com/zio/zio-sbt) +[![Production Ready](https://img.shields.io/badge/Project%20Stage-Production%20Ready-brightgreen.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-sbt/workflows/CI/badge.svg) [![Sonatype Releases](https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-sbt-website_2.12.svg?label=Sonatype%20Release)](https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-sbt-website_2.12/) [![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-sbt-website_2.12.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-sbt-website_2.12/) [![javadoc](https://javadoc.io/badge2/dev.zio/zio-sbt-docs_2.13/javadoc.svg)](https://javadoc.io/doc/dev.zio/zio-sbt-docs_2.13) [![ZIO SBT](https://img.shields.io/github/stars/zio/zio-sbt?style=social)](https://github.com/zio/zio-sbt) ## Installation Add the following lines to your `plugin.sbt` file: ```scala -addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.2.5") +addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.2.4") ``` Then you can enable it by using the following code in your `build.sbt` file: diff --git a/docs/developer-notes.md b/docs/developer-notes.md index 9f7530e1..13c776fa 100644 --- a/docs/developer-notes.md +++ b/docs/developer-notes.md @@ -6,6 +6,7 @@ title: "Developer Notes" ## Todo List ### ZIO SBT Website + - Add a command to make a version history page in documentation - Check if the committed workflow is valid or not. - To generate README.md file, it doesn't need to compile all docs. @@ -13,4 +14,5 @@ title: "Developer Notes" - Support for various scala versions - Support for auto update PRs - Add workflow for header checker +- Add prepare task to perform preliminary tasks before PR diff --git a/zio-sbt-website/src/main/scala/zio/sbt/WebsitePlugin.scala b/zio-sbt-website/src/main/scala/zio/sbt/WebsitePlugin.scala index 4d4d4e0d..e6dc8b99 100644 --- a/zio-sbt-website/src/main/scala/zio/sbt/WebsitePlugin.scala +++ b/zio-sbt-website/src/main/scala/zio/sbt/WebsitePlugin.scala @@ -79,6 +79,13 @@ object WebsitePlugin extends sbt.AutoPlugin { override def requires: Plugins = MdocPlugin && UnifiedScaladocPlugin + private def artifactVersion(version: String): String = { + val array = version.split('.') + if (array.head != "3") { + array.dropRight(1).mkString(".") + } else "3" + } + override lazy val projectSettings: Seq[Setting[_ <: Object]] = Seq( compileDocs := compileDocsTask.evaluated, @@ -108,7 +115,7 @@ object WebsitePlugin extends sbt.AutoPlugin { projectStage = badge.projectStage, groupId = organization.value, artifactId = badge.artifact, - docsArtifactId = moduleName.value, + docsArtifactId = moduleName.value + '_' + artifactVersion(scalaVersion.value), githubUser = "zio", githubRepo = scmInfo.value.map(_.browseUrl.getPath.split('/').last).getOrElse("github repo not provided"),