@@ -22,7 +22,7 @@ that the license and copyright notices are preserved. For the record, Scala itse
22
22
23
23
Once you have chosen a license, * apply* it to your project by creating a ` LICENSE ` file in the root directory
24
24
of your project with the license contents or a link to it. This file usually indicates who owns the copyright.
25
- In our example of [ LICENSE file] ( https://github.com/scalacenter/library-example/blob/master /LICENSE ) , we have
25
+ In our example of [ LICENSE file] ( https://github.com/scalacenter/library-example/blob/main /LICENSE ) , we have
26
26
written that all the contributors (as per the Git log) own the copyright.
27
27
28
28
## Host the Source Code
@@ -31,15 +31,15 @@ We recommend sharing the source code of your library by hosting it on a public [
31
31
hosting site such as [ GitHub] ( https://github.com ) , [ Bitbucket] ( https://bitbucket.org ) or [ GitLab] ( https://gitlab.com ) .
32
32
In our example, we use GitHub.
33
33
34
- Your project should include a [ README] ( https://github.com/scalacenter/library-example/blob/master /README.md ) file
34
+ Your project should include a [ README] ( https://github.com/scalacenter/library-example/blob/main /README.md ) file
35
35
including a description of what the library does and some documentation (or links to the documentation).
36
36
37
37
You should take care of putting only source files under version control. For instance, artifacts generated by the
38
38
build system should * not* be versioned. You can instruct Git to ignore such files by adding them to a
39
- [ .gitignore] ( https://github.com/scalacenter/library-example/blob/master /.gitignore ) file.
39
+ [ .gitignore] ( https://github.com/scalacenter/library-example/blob/main /.gitignore ) file.
40
40
41
41
In case you are using sbt, make sure your repository has a
42
- [ project/build.properties] ( https://github.com/scalacenter/library-example/blob/master /project/build.properties )
42
+ [ project/build.properties] ( https://github.com/scalacenter/library-example/blob/main /project/build.properties )
43
43
file indicating the sbt version to use, so that people (or tools) working on your repository will automatically
44
44
use the correct sbt version.
45
45
@@ -71,32 +71,35 @@ jobs:
71
71
ci :
72
72
runs-on : ubuntu-latest
73
73
steps :
74
- - uses : actions/checkout@v2 # Retrieve the content of the repository
75
- - uses : actions/setup-java@v2 # Set up a jdk
74
+ - uses : actions/checkout@v3 # Retrieve the content of the repository
75
+ - uses : actions/setup-java@v3 # Set up a jdk
76
76
with :
77
77
distribution : temurin
78
78
java-version : 8
79
+ cache : sbt # Cache the artifacts downloaded by sbt accross CI runs
79
80
- name : unit tests # Custom action consisting of a shell command
80
81
run : sbt +test
81
82
~~~
82
83
83
84
This workflow is called *Continuous integration* and it will run every time one
84
85
or more commits are pushed to the repository. It contains only one job called
85
86
*ci*, which will run on an Ubuntu runner and that is composed of three
86
- actions. The action `setup-scala` installs the sbt launcher in the runner. Then
87
- the job runs `sbt +test`, which loads the sbt version specified in
87
+ actions. The action `setup-java` installs a JDK and caches the library dependencies
88
+ downloaded by sbt so that they are not downloaded again everytime the CI runs.
89
+
90
+ Then, the job runs `sbt +test`, which loads the sbt version specified in
88
91
` project/build.properties` , and runs the project tests using the Scala version
89
92
defined in the file `build.sbt`.
90
93
91
94
The workflow above will run at any push to any branch of the repository. You
92
95
can specify the branch or add more triggers such as pull requests, releases,
93
96
tags or schedules. More information about workflow triggers is available
94
97
[here](https://docs.github.com/en/actions/reference/events-that-trigger-workflows).
95
- while the `setup-scala ` action is hosted [in this
96
- repository](https://github.com/olafurpg /setup-scala ).
98
+ while the `setup-java ` action is hosted [in this
99
+ repository](https://github.com/actions /setup-java ).
97
100
98
101
For reference, here is our complete [workflow example
99
- file](https://github.com/scalacenter/library-example/blob/master /.github/. workflows/ci.yml).
102
+ file](https://github.com/scalacenter/library-example/blob/main /.github/workflows/ci.yml).
100
103
101
104
# # Publish a Release
102
105
@@ -309,10 +312,14 @@ jobs:
309
312
release :
310
313
runs-on : ubuntu-latest
311
314
steps :
312
- - uses : actions/checkout@v2
315
+ - uses : actions/checkout@v3
316
+ with :
317
+ fetch-depth : 0 # fetch all tags, required to compute the release version
318
+ - uses : actions/setup-java@v3
313
319
with :
314
- fetch-depth: 0 # fetch all tags, required for sbt-dynver
315
- - uses : olafurpg/setup-scala@v12
320
+ distribution : temurin
321
+ java-version : 8
322
+ cache : sbt
316
323
- run : sbt ci-release
317
324
env :
318
325
PGP_PASSPHRASE : ${{ secrets.PGP_PASSPHRASE }}
@@ -561,8 +568,14 @@ jobs:
561
568
publishSite :
562
569
runs-on : ubuntu-latest
563
570
steps :
564
- - uses : actions/checkout@v2
565
- - uses : olafurpg/setup-scala@v12
571
+ - uses : actions/checkout@v3
572
+ with :
573
+ fetch-depth : 0
574
+ - uses : actions/setup-java@v3
575
+ with :
576
+ distribution : temurin
577
+ java-version : 8
578
+ cache : sbt
566
579
- name : Generate site
567
580
run : sbt makeSite
568
581
- uses : JamesIves/github-pages-deploy-action@4.1.3
@@ -585,7 +598,7 @@ Add a `CONTRIBUTING.md` file to your repository, answering the following questio
585
598
What are the coding practices to follow? Where are the tests and how to run them?
586
599
587
600
For reference, you can read our minimal example of
588
- [ ` CONTRIBUTING.md ` file] ( https://github.com/scalacenter/library-example/blob/master /CONTRIBUTING.md ) .
601
+ [ ` CONTRIBUTING.md ` file] ( https://github.com/scalacenter/library-example/blob/main /CONTRIBUTING.md ) .
589
602
590
603
### Issue Labels
591
604
0 commit comments