You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by fa...@apache.org on 2023/03/09 10:40:33 UTC

[incubator-pekko-persistence-dynamodb] branch main updated: try to set up nightly publish (#21)

This is an automated email from the ASF dual-hosted git repository.

fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-persistence-dynamodb.git


The following commit(s) were added to refs/heads/main by this push:
     new a0acbda  try to set up nightly publish (#21)
a0acbda is described below

commit a0acbda91b4ff49d35e74c891087195eb3e20ed2
Author: PJ Fanning <pj...@users.noreply.github.com>
AuthorDate: Thu Mar 9 11:40:26 2023 +0100

    try to set up nightly publish (#21)
---
 .github/workflows/publish-nightly.yml  | 51 ++++++++++++++++++++++++++++++++++
 build.sbt                              |  4 +--
 project/MetaInfLicenseNoticeCopy.scala | 31 ---------------------
 project/Publish.scala                  | 39 ++++++++++----------------
 project/plugins.sbt                    |  1 +
 5 files changed, 68 insertions(+), 58 deletions(-)

diff --git a/.github/workflows/publish-nightly.yml b/.github/workflows/publish-nightly.yml
new file mode 100644
index 0000000..2424692
--- /dev/null
+++ b/.github/workflows/publish-nightly.yml
@@ -0,0 +1,51 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Publish nightly artifacts
+
+on:
+  schedule:
+    - cron: "0 0 * * *"
+
+permissions:
+  contents: read
+
+jobs:
+  publish-nightly:
+    name: Publish nightly
+    runs-on: ubuntu-20.04
+    if: github.repository == 'apache/incubator-pekko-persistence-dynamodb'
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+
+      - name: Setup Java 8
+        uses: actions/setup-java@v3
+        with:
+          distribution: temurin
+          java-version: 8
+
+      - name: Publish to Apache Maven repo
+        env:
+          NEXUS_USER: ${{ secrets.NEXUS_USER }}
+          NEXUS_PW: ${{ secrets.NEXUS_PW }}
+        run: sbt +publish
+
+      - name: Cache Coursier cache
+        uses: coursier/cache-action@v6.4.0
diff --git a/build.sbt b/build.sbt
index a3ff4e7..5ff8f47 100644
--- a/build.sbt
+++ b/build.sbt
@@ -11,6 +11,8 @@ val testcontainersScalaVersion = "0.40.10"
 
 resolvers += "Apache Nexus Snapshots".at("https://repository.apache.org/content/repositories/snapshots/")
 
+ThisBuild / apacheSonatypeProjectProfile := "pekko"
+
 libraryDependencies ++= Seq(
   "com.amazonaws" % "aws-java-sdk-core" % amzVersion,
   "com.amazonaws" % "aws-java-sdk-dynamodb" % amzVersion,
@@ -32,5 +34,3 @@ Test / parallelExecution := false
 Test / fork := true
 logBuffered := false
 Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oDF")
-
-MetaInfLicenseNoticeCopy.settings
diff --git a/project/MetaInfLicenseNoticeCopy.scala b/project/MetaInfLicenseNoticeCopy.scala
deleted file mode 100644
index 1f18575..0000000
--- a/project/MetaInfLicenseNoticeCopy.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-import sbt.Keys._
-import sbt._
-
-/**
- * Copies LICENSE and NOTICE files into jar META-INF dir
- */
-object MetaInfLicenseNoticeCopy {
-
-  val settings: Seq[Setting[_]] = inConfig(Compile)(
-    Seq(
-      resourceGenerators += copyFileToMetaInf(resourceManaged, "LICENSE"),
-      resourceGenerators += copyFileToMetaInf(resourceManaged, "NOTICE"),
-      resourceGenerators += copyFileToMetaInf(resourceManaged, "DISCLAIMER")))
-
-  def copyFileToMetaInf(dir: SettingKey[File], fileName: String) = Def.task[Seq[File]] {
-    val fromFile = (LocalRootProject / baseDirectory).value / fileName
-    val toFile = resourceManaged.value / "META-INF" / fileName
-    IO.copyFile(fromFile, toFile)
-    Seq(toFile)
-  }
-
-}
diff --git a/project/Publish.scala b/project/Publish.scala
index 4de2801..bb507a3 100644
--- a/project/Publish.scala
+++ b/project/Publish.scala
@@ -14,29 +14,27 @@ package org.apache.pekko
 
 import sbt._
 import sbt.Keys._
+
 import java.io.File
 import sbtrelease.ReleasePlugin.autoImport.releasePublishArtifactsAction
+import org.mdedetrich.apache.sonatype.SonatypeApachePlugin
+import SonatypeApachePlugin.autoImport.apacheSonatypeDisclaimerFile
 
 object Publish extends AutoPlugin {
 
   val defaultPublishTo = settingKey[File]("Default publish directory")
 
   override def trigger = allRequirements
-  override def requires = sbtrelease.ReleasePlugin
+  override def requires = sbtrelease.ReleasePlugin && SonatypeApachePlugin
 
   override lazy val projectSettings = Seq(
     crossPaths := false,
     pomExtra := pekkoPomExtra,
-    publishTo := akkaPublishTo.value,
-    credentials ++= akkaCredentials,
-    organization := "org.apache.pekko",
-    organizationName := "Apache Software Foundation",
-    organizationHomepage := Some(url("https://www.apache.org")),
-    licenses := Seq(("Apache License, Version 2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))),
+    credentials ++= apacheNexusCredentials,
     homepage := Some(url("https://github.com/apache/incubator-pekko-persistence-dynamodb")),
-    publishMavenStyle := true,
     pomIncludeRepository := { x => false },
-    defaultPublishTo := crossTarget.value / "repository")
+    defaultPublishTo := crossTarget.value / "repository",
+    apacheSonatypeDisclaimerFile := Some((LocalRootProject / baseDirectory).value / "DISCLAIMER"))
 
   def pekkoPomExtra = {
     <developers>
@@ -49,22 +47,13 @@ object Publish extends AutoPlugin {
     </developers>
   }
 
-  private def akkaPublishTo =
-    Def.setting {
-      sonatypeRepo(version.value).orElse(localRepo(defaultPublishTo.value))
-    }
+  private val apacheBaseRepo = "repository.apache.org"
 
-  private def sonatypeRepo(version: String): Option[Resolver] =
-    Option(sys.props("publish.maven.central")).filter(_.toLowerCase == "true").map { _ =>
-      val nexus = "https://oss.sonatype.org/"
-      if (version.endsWith("-SNAPSHOT")) "snapshots".at(nexus + "content/repositories/snapshots")
-      else "releases".at(nexus + "service/local/staging/deploy/maven2")
+  private def apacheNexusCredentials: Seq[Credentials] =
+    (sys.env.get("NEXUS_USER"), sys.env.get("NEXUS_PW")) match {
+      case (Some(user), Some(password)) =>
+        Seq(Credentials("Sonatype Nexus Repository Manager", apacheBaseRepo, user, password))
+      case _ =>
+        Seq.empty
     }
-
-  private def localRepo(repository: File) =
-    Some(Resolver.file("Default Local Repository", repository))
-
-  private def akkaCredentials: Seq[Credentials] =
-    Option(System.getProperty("pekko.publish.credentials", null)).map(f => Credentials(new File(f))).toSeq
-
 }
diff --git a/project/plugins.sbt b/project/plugins.sbt
index b62b591..79bbc4c 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -6,5 +6,6 @@ addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
 addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.7")
 addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3")
 addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
+addSbtPlugin("org.mdedetrich" % "sbt-apache-sonatype" % "0.1.5")
 // https://github.com/dwijnand/sbt-dynver
 addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org