Skip to content

Commit fd1bfaa

Browse files
committed
Refactor build & publish
1 parent 13e962e commit fd1bfaa

File tree

2 files changed

+34
-41
lines changed

2 files changed

+34
-41
lines changed

build.sbt

+17-19
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
organization := "fr.janalyse"
21
name := "code-examples-manager"
3-
homepage := Some(new URL("https://github.com/dacr/code-examples-manager"))
2+
organization := "fr.janalyse"
3+
description := "Tool to manage set of code examples : synchronize and publish, automated execution, ..."
44

55
licenses += "NON-AI-APACHE2" -> url(s"https://github.com/non-ai-licenses/non-ai-licenses/blob/main/NON-AI-APACHE2")
66

7-
scmInfo := Some(
8-
ScmInfo(
9-
url(s"https://github.com/dacr/code-examples-manager.git"),
10-
s"[email protected]:dacr/code-examples-manager.git"
11-
)
12-
)
13-
147
scalaVersion := "3.5.1"
158

169
scalacOptions += "-Xkind-projector:underscores"
1710

18-
mainClass := Some("fr.janalyse.cem.Main")
19-
2011
lazy val versions = new {
2112
val sttp = "3.9.8"
2213
val zio = "2.1.9"
@@ -52,16 +43,23 @@ libraryDependencies ++= Seq(
5243

5344
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
5445

55-
enablePlugins(SbtTwirl)
56-
57-
// TODO - to remove when twirl will be available for scala3
58-
//libraryDependencies := libraryDependencies.value.map {
59-
// case module if module.name == "twirl-api" => module.cross(CrossVersion.for3Use2_13)
60-
// case module => module
61-
//}
62-
6346
TwirlKeys.templateImports += "fr.janalyse.cem.model._"
6447

48+
mainClass := Some("fr.janalyse.cem.Main")
49+
6550
// ZIO-LMDB requires special authorization at JVM level
6651
ThisBuild / fork := true
6752
ThisBuild / javaOptions ++= Seq("--add-opens", "java.base/java.nio=ALL-UNNAMED", "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED")
53+
54+
enablePlugins(SbtTwirl)
55+
56+
homepage := Some(url("https://github.com/dacr/code-examples-manager"))
57+
scmInfo := Some(ScmInfo(url(s"https://github.com/dacr/code-examples-manager.git"), s"[email protected]:dacr/code-examples-manager.git"))
58+
developers := List(
59+
Developer(
60+
id = "dacr",
61+
name = "David Crosson",
62+
email = "[email protected]",
63+
url = url("https://github.com/dacr")
64+
)
65+
)

publish.sbt

+17-22
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,35 @@
1-
pomIncludeRepository := { _ => false }
2-
3-
releaseCrossBuild := true
4-
releasePublishArtifactsAction := PgpKeys.publishSigned.value
5-
publishMavenStyle := true
1+
pomIncludeRepository := { _ => false }
2+
publishMavenStyle := true
63
Test / publishArtifact := false
7-
publishTo := Some(if (isSnapshot.value) Opts.resolver.sonatypeOssSnapshots.head else Opts.resolver.sonatypeStaging)
4+
releaseCrossBuild := true
5+
versionScheme := Some("semver-spec")
86

9-
Global / PgpKeys.useGpg := true // workaround with pgp and sbt 1.2.x
10-
pgpSecretRing := pgpPublicRing.value // workaround with pgp and sbt 1.2.x
11-
12-
pomExtra in Global := {
13-
<developers>
14-
<developer>
15-
<id>dacr</id>
16-
<name>David Crosson</name>
17-
<url>https://github.com/dacr</url>
18-
</developer>
19-
</developers>
7+
publishTo := {
8+
// For accounts created after Feb 2021:
9+
// val nexus = "https://s01.oss.sonatype.org/"
10+
val nexus = "https://oss.sonatype.org/"
11+
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
12+
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
2013
}
2114

22-
releaseTagComment := s"Releasing ${(ThisBuild / version).value}"
23-
releaseCommitMessage := s"Setting version to ${(ThisBuild / version).value}"
15+
releasePublishArtifactsAction := PgpKeys.publishSigned.value
16+
17+
releaseTagComment := s"Releasing ${(ThisBuild / version).value}"
18+
releaseCommitMessage := s"Setting version to ${(ThisBuild / version).value}"
2419
releaseNextCommitMessage := s"[ci skip] Setting version to ${(ThisBuild / version).value}"
2520

26-
import ReleaseTransformations._
21+
import ReleaseTransformations.*
2722
releaseProcess := Seq[ReleaseStep](
2823
checkSnapshotDependencies,
2924
inquireVersions,
30-
//runClean,
25+
runClean,
3126
runTest,
3227
setReleaseVersion,
3328
commitReleaseVersion,
3429
tagRelease,
3530
publishArtifacts,
31+
releaseStepCommand("sonatypeReleaseAll"),
3632
setNextVersion,
3733
commitNextVersion,
38-
releaseStepCommand("sonatypeReleaseAll"),
3934
pushChanges
4035
)

0 commit comments

Comments
 (0)