@@ -146,8 +146,8 @@ and [sbt-pgp](https://www.scala-sbt.org/sbt-pgp/) plugins to publish your artifa
146146dependencies to your ` project/plugins.sbt ` file:
147147
148148~~~ scala
149- addSbtPlugin(" org.xerial.sbt" % " sbt-sonatype" % " 3.9.7 " )
150- addSbtPlugin(" com.jsuereth " % " sbt-pgp" % " 2.1 .1" )
149+ addSbtPlugin(" org.xerial.sbt" % " sbt-sonatype" % " 3.9.21 " )
150+ addSbtPlugin(" com.github.sbt " % " sbt-pgp" % " 2.2 .1" )
151151~~~
152152
153153And make sure your build fulfills the [ Sonatype requirements] ( https://central.sonatype.org/publish/requirements )
@@ -189,7 +189,7 @@ Last, we recommend using the [sbt-dynver](https://github.com/dwijnand/sbt-dynver
189189of your releases. Add the following dependency to your ` project/plugins.sbt ` file:
190190
191191~~~ scala
192- addSbtPlugin(" com.dwijnand " % " sbt-dynver" % " 4.1 .1" )
192+ addSbtPlugin(" com.github.sbt " % " sbt-dynver" % " 5.0 .1" )
193193~~~
194194
195195And make sure your build does ** not** define the ` version ` setting.
@@ -234,6 +234,15 @@ Continuous publication addresses these issues by delegating the publication proc
234234follows: any contributor with write access to the repository can cut a release by pushing a Git tag, the CI server
235235first checks that the tests pass and then runs the publication commands.
236236
237+ We achieve this by replacing the plugins ` sbt-pgp ` , ` sbt-sonatype ` , and ` sbt-dynver ` with ` sbt-ci-release ` , in the file ` project/plugins.sbt ` :
238+
239+ {% highlight diff %}
240+ - addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
241+ - addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.21")
242+ - addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1")
243+ + addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
244+ {% endhighlight %}
245+
237246The remaining sections show how to setup GitHub Actions for continuous publication on Sonatype. You can find instructions
238247for Travis CI in the [ sbt-ci-release] ( https://github.com/olafurpg/sbt-ci-release ) plugin documentation.
239248
@@ -298,14 +307,14 @@ gpg --armor --export %LONG_ID%
298307
299308#### Publish From the CI Server
300309
301- On GitHub Actions, you can define a workflow to publish the library when a tag is pushed:
310+ On GitHub Actions, you can define a workflow to publish the library when a tag starting with “v” is pushed:
302311
303- ~~~ yaml
312+ {% highlight yaml %}
313+ {% raw %}
304314# .github/workflows/publish.yml
305315name: Continuous publication
306316on:
307317 push:
308- branches : ['**']
309318 tags: [ v* ]
310319
311320jobs:
@@ -326,7 +335,8 @@ jobs:
326335 PGP_SECRET: ${{ secrets.PGP_SECRET }}
327336 SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
328337 SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
329- ~~~
338+ {% endraw %}
339+ {% endhighlight %}
330340
331341The ` env ` statement exposes the secrets you defined earlier to the publication process through
332342environment variables.
@@ -340,15 +350,17 @@ $ git tag v0.2.0
340350$ git push origin v0.2.0
341351~~~
342352
353+ This will trigger the workflow, which will ultimately invoke ` sbt ci-release ` , which will perform a ` publishSigned ` followed by a ` sonatypeRelease ` .
354+
343355## Cross-Publish
344356
345- If you have written a library, you probably want it to be usable from several Scala major versions (e.g., 2.11.x,
346- 2.12.x, 2.13.x, etc.).
357+ If you have written a library, you probably want it to be usable from several Scala major versions (e.g.,
358+ 2.12.x, 2.13.x, 3.x, etc.).
347359
348360Define the versions you want to support in the ` crossScalaVersions ` setting, in your ` build.sbt ` file:
349361
350362~~~ scala
351- crossScalaVersions := Seq (" 2.13.6 " , " 2.12.14 " )
363+ crossScalaVersions := Seq (" 3.3.0 " , " 2.13.11 " , " 2.12.18 " )
352364scalaVersion := crossScalaVersions.value.head
353365~~~
354366
@@ -381,19 +393,17 @@ most other documentation generators, which are based on Ruby, Node.js or Python)
381393To install Paradox and sbt-site, add the following lines to your ` project/plugins.sbt ` file:
382394
383395~~~ scala
384- addSbtPlugin(" com.typesafe.sbt" % " sbt-site" % " 1.4.1" )
385- addSbtPlugin(" com.lightbend.paradox" % " sbt-paradox" % " 0.9.2" )
396+ addSbtPlugin(" com.github.sbt" % " sbt-site-paradox" % " 1.5.0" )
386397~~~
387398
388399And then add the following configuration to your ` build.sbt ` file:
389400
390401{% highlight scala %}
391- enablePlugins(ParadoxPlugin, ParadoxSitePlugin )
402+ enablePlugins(ParadoxSitePlugin, SitePreviewPlugin )
392403Paradox / sourceDirectory := sourceDirectory.value / "documentation"
393404{% endhighlight %}
394405
395- The ` ParadoxPlugin ` is responsible for generating the website, and the ` ParadoxSitePlugin ` provides
396- integration with ` sbt-site ` .
406+ The ` ParadoxSitePlugin ` provides a task ` makeSite ` that generates a website using [ Paradox] ( https://developer.lightbend.com/docs/paradox/current/ ) , and the ` SitePreviewPlugin ` provides handy tasks when working on the website content, to preview the result in your browser.
397407The second line is optional, it defines the location of the website source files. In our case, in
398408` src/documentation ` .
399409
@@ -402,6 +412,7 @@ uses the library name as title, shows a short sentence describing the purpose of
402412snippet for adding the library to a build definition:
403413
404414{% highlight markdown %}
415+ {% raw %}
405416# Library Example
406417
407418A library that does nothing.
@@ -420,6 +431,7 @@ libraryDependencies += "ch.epfl.scala" %% "library-example" % "$project.version$
420431* [ Getting Started] ( getting-started.md )
421432* [ Reference] ( reference.md )
422433@@@
434+ {% endraw %}
423435{% endhighlight %}
424436
425437Note that in our case we rely on a variable substitution mechanism to inject the correct version number
@@ -482,11 +494,13 @@ You can embed the fragment surrounded by the `#do-nothing` identifiers with the
482494as shown in the ` src/documentation/reference.md ` file:
483495
484496{% highlight markdown %}
497+ {% raw %}
485498# Reference
486499
487500The ` doNothing ` function takes anything as parameter and returns it unchanged:
488501
489502@@snip [ Usage.scala] ( $root$/src/test/scala/ch/epfl/scala/Usage.scala ) { #do-nothing }
503+ {% endraw %}
490504{% endhighlight %}
491505
492506The resulting documentation looks like the following:
@@ -523,7 +537,7 @@ The `@scaladoc` directive will produce a link to the `/api/ch/epfl/scala/Example
523537Add the ` sbt-ghpages ` plugin to your ` project/plugins.sbt ` :
524538
525539~~~ scala
526- addSbtPlugin(" com.typesafe .sbt" % " sbt-ghpages" % " 0.6.3 " )
540+ addSbtPlugin(" com.github .sbt" % " sbt-ghpages" % " 0.8.0 " )
527541~~~
528542
529543And add the following configuration to your ` build.sbt ` :
@@ -559,7 +573,7 @@ can browse it at [https://scalacenter.github.io/library-example/](https://scalac
559573You can extend ` .github/workflows/publish.yml ` to automatically publish documentation to GitHub pages.
560574To do so, add another job:
561575
562- ``` yml
576+ ``` yaml
563577# .github/workflows/publish.yml
564578name : Continuous publication
565579
@@ -651,7 +665,7 @@ break this versioning policy. Add the `sbt-mima-plugin` to your build with the f
651665`project/plugins.sbt` file :
652666
653667~~~ scala
654- addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.9 .2")
668+ addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1 .2")
655669~~~
656670
657671Configure it as follows, in ` build.sbt ` :
0 commit comments