From b74c778022d6341686cd3a10957ba0a7dfb7dcf6 Mon Sep 17 00:00:00 2001 From: Milad Khajavi Date: Thu, 12 Jan 2023 17:06:45 +0330 Subject: [PATCH] Add Scaladoc support (#724) --- .github/workflows/site.yml | 36 ++++++++++++++++++++++++++++++------ README.md | 4 +--- build.sbt | 17 +++++++---------- project/plugins.sbt | 2 +- 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index ff3853386..3550fbec3 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -10,7 +10,31 @@ name: Website push: branches: - master + pull_request: {} jobs: + build: + name: Build and Test + runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' }} + steps: + - name: Git Checkout + uses: actions/checkout@v3.3.0 + with: + fetch-depth: '0' + - name: Setup Scala + uses: actions/setup-java@v3.9.0 + with: + distribution: temurin + java-version: 17 + check-latest: true + - name: Check if the README file is up to date + run: sbt docs/checkReadme + - name: Check if the site workflow is up to date + run: sbt docs/checkGithubWorkflow + - name: Check artifacts build process + run: sbt +publishLocal + - name: Check website build process + run: sbt docs/clean; sbt docs/buildWebsite publish-docs: name: Publish Docs runs-on: ubuntu-latest @@ -21,7 +45,7 @@ jobs: with: fetch-depth: '0' - name: Setup Scala - uses: actions/setup-java@v3.6.0 + uses: actions/setup-java@v3.9.0 with: distribution: temurin java-version: 17 @@ -38,6 +62,7 @@ jobs: generate-readme: name: Generate README runs-on: ubuntu-latest + if: ${{ (github.event_name == 'push') || ((github.event_name == 'release') && (github.event_name == 'published')) }} steps: - name: Git Checkout uses: actions/checkout@v3.3.0 @@ -45,7 +70,7 @@ jobs: ref: ${{ github.head_ref }} fetch-depth: '0' - name: Setup Scala - uses: actions/setup-java@v3.6.0 + uses: actions/setup-java@v3.9.0 with: distribution: temurin java-version: 17 @@ -59,9 +84,9 @@ jobs: git add README.md git commit -m "Update README.md" || echo "No changes to commit" - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 + uses: peter-evans/create-pull-request@v4.2.3 with: - body: | + body: |- Autogenerated changes after running the `sbt docs/generateReadme` command of the [zio-sbt-website](https://zio.dev/zio-sbt) plugin. I will automatically update the README.md file whenever there is new change for README.md, e.g. @@ -69,6 +94,5 @@ jobs: - After any changes to the "docs/index.md" file, I will update the README.md file accordingly. branch: zio-sbt-website/update-readme commit-message: Update README.md - branch-suffix: short-commit-hash + delete-branch: true title: Update README.md - diff --git a/README.md b/README.md index db7d2c243..17c0de881 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,7 @@ > The client is still a work-in-progress. Watch this space! -|Project Stage | CI | Release | Snapshot | Discord | Github | -|--------------|----|---------|----------|---------|--------| -|[![Experimental](https://img.shields.io/badge/Project%20Stage-Experimental-yellowgreen.svg)](https://github.com/zio/zio/wiki/Project-Stages) |![CI Badge](https://github.com/zio/zio-redis/workflows/CI/badge.svg) |[![Sonatype Releases](https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-redis_2.12.svg)](https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-redis_2.12/) |[![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-redis_2.12.svg)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-redis_2.12/) |[![Chat on Discord!](https://img.shields.io/discord/629491597070827530?logo=discord)](https://discord.gg/2ccFBr4) |[![ZIO Redis](https://img.shields.io/github/stars/zio/zio-redis?style=social)](https://github.com/zio/zio-redis) | +[![Experimental](https://img.shields.io/badge/Project%20Stage-Experimental-yellowgreen.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-redis/workflows/CI/badge.svg) [![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-redis_2.13.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-redis_2.13/) [![ZIO Redis](https://img.shields.io/github/stars/zio/zio-redis?style=social)](https://github.com/zio/zio-redis) ## Introduction diff --git a/build.sbt b/build.sbt index fe51d36f5..d6bed55f8 100644 --- a/build.sbt +++ b/build.sbt @@ -33,7 +33,7 @@ lazy val root = project .in(file(".")) .settings(publish / skip := true) - .aggregate(redis, benchmarks, example) + .aggregate(redis, benchmarks, example, docs) lazy val redis = project @@ -98,15 +98,12 @@ lazy val docs = project moduleName := "zio-redis-docs", scalacOptions -= "-Yno-imports", scalacOptions -= "-Xfatal-warnings", - projectName := "ZIO Redis", - badgeInfo := Some( - BadgeInfo( - artifact = "zio-redis_2.12", - projectStage = ProjectStage.Experimental - ) - ), - docsPublishBranch := "master", - libraryDependencies += "dev.zio" %% "zio-schema-protobuf" % "0.3.1" + projectName := "ZIO Redis", + mainModuleName := (redis / moduleName).value, + projectStage := ProjectStage.Experimental, + ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(redis), + docsPublishBranch := "master", + libraryDependencies += "dev.zio" %% "zio-schema-protobuf" % "0.3.1" ) .dependsOn(redis) .enablePlugins(WebsitePlugin) diff --git a/project/plugins.sbt b/project/plugins.sbt index 321ecd90c..1fba09111 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -8,6 +8,6 @@ addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.6") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3") -addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.2.4") +addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.3.4") libraryDependencies += "org.snakeyaml" % "snakeyaml-engine" % "2.5"