@zio.dev/zio-sbt 0.8.5 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.md +35 -6
- package/package.json +1 -1
package/index.md
CHANGED
|
@@ -12,9 +12,9 @@ _ZIO SBT_ contains multiple sbt plugins that are useful for ZIO projects. It pro
|
|
|
12
12
|
Add the following lines to your `project/plugins.sbt` file:
|
|
13
13
|
|
|
14
14
|
```scala
|
|
15
|
-
addSbtPlugin("dev.zio" % "zio-sbt-ecosystem" % "0.8.
|
|
16
|
-
addSbtPlugin("dev.zio" % "zio-sbt-ci" % "0.8.
|
|
17
|
-
addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.8.
|
|
15
|
+
addSbtPlugin("dev.zio" % "zio-sbt-ecosystem" % "0.8.6")
|
|
16
|
+
addSbtPlugin("dev.zio" % "zio-sbt-ci" % "0.8.6")
|
|
17
|
+
addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.8.6")
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
Then you can enable them by using the following code in your `build.sbt` file:
|
|
@@ -130,7 +130,7 @@ ZIO SBT CI plugin generates a default GitHub workflow that includes common CI ta
|
|
|
130
130
|
To use ZIO SBT CI plugin, add the following lines to your `plugins.sbt` file:
|
|
131
131
|
|
|
132
132
|
```scala
|
|
133
|
-
addSbtPlugin("dev.zio" % "zio-sbt-ci" % "0.8.
|
|
133
|
+
addSbtPlugin("dev.zio" % "zio-sbt-ci" % "0.8.6")
|
|
134
134
|
|
|
135
135
|
resolvers ++= Resolver.sonatypeOssRepos("public")
|
|
136
136
|
```
|
|
@@ -200,6 +200,19 @@ The default value mirrors the bots used by the `zio/zio` repository: `Seq(Depend
|
|
|
200
200
|
>
|
|
201
201
|
> `GITHUB_TOKEN` can never be granted the "workflows" scope needed to auto-merge a bot PR that touches `.github/workflows/**`, so `auto-merge.yml` mints a GitHub App token for that case instead, falling back to `GITHUB_TOKEN` when no app is configured (which still auto-merges ordinary, non-workflow-touching PRs fine). This needs the same `APP_ID`/`APP_PRIVATE_KEY` secrets as `update-readme`, and the [ZIO Assistant](https://github.com/apps/zio-assistant) app installation must additionally have the **Workflows** repository permission granted and accepted — without it, workflow-touching PRs still fail to auto-merge and need a manual merge.
|
|
202
202
|
|
|
203
|
+
### Regenerating Workflows on Bot PRs
|
|
204
|
+
|
|
205
|
+
A bot PR often changes something the generated files depend on: Scala Steward bumping `zio-sbt-ci` itself, or Dependabot bumping an action pin in a generated workflow. Either leaves `ciCheckGithubWorkflow` failing in the Lint job, so the PR is red and `auto-merge.yml` never merges it, with nobody to fix it.
|
|
206
|
+
|
|
207
|
+
`ciEnableRegenerateWorkflows` defaults to `true`, so `ciGenerateGithubWorkflow` also generates `regenerate-workflows.yml`. On every same-repository PR opened by one of `ciDependencyUpdateBots`, it checks out the PR branch, runs `sbt ciGenerateGithubWorkflow`, and, if anything under `.github` changed, commits and pushes the result to that branch. The push re-runs CI on the new commit and, since `auto-merge.yml` re-evaluates on every push, the PR then merges once CI is green.
|
|
208
|
+
|
|
209
|
+
Things to know:
|
|
210
|
+
|
|
211
|
+
- It pushes with the GitHub App token (`APP_ID`/`APP_PRIVATE_KEY`, the same as `auto-merge.yml`): a push made with `GITHUB_TOKEN` does not trigger CI, and `GITHUB_TOKEN` cannot push changes to `.github/workflows/**` at all. The App needs the **Workflows** repository permission.
|
|
212
|
+
- Workflows triggered by `dependabot[bot]` read the **Dependabot** secrets store, not the repository's Actions secrets. Add `APP_ID` and `APP_PRIVATE_KEY` under Settings → Secrets and variables → Dependabot.
|
|
213
|
+
- Regeneration is driven by your build, so a Dependabot bump of an action pin *in a generated workflow* is regenerated back to the plugin's own pin and the PR ends up empty. The plugin owns those pins; they move when `zio-sbt-ci` is bumped. If you rely on this, remove the `github-actions` ecosystem from `ciDependabotConfig`.
|
|
214
|
+
- Set `ciEnableRegenerateWorkflows := false` to opt out; the plugin then deletes only a `regenerate-workflows.yml` carrying its "autogenerated" header.
|
|
215
|
+
|
|
203
216
|
### Netlify Deploy Previews
|
|
204
217
|
|
|
205
218
|
Setting `ciEnableDeployPreview := true` makes `ciGenerateGithubWorkflow` also generate `deploy-preview.yml`, which deploys the built Docusaurus site to Netlify for every pull request that touches `docs/` or `website/`.
|
|
@@ -295,6 +308,7 @@ All settings are `ThisBuild`-scoped.
|
|
|
295
308
|
| `ciJvmOptions` | `Seq[String]` | `Seq.empty` | Appended to `JDK_JAVA_OPTIONS` |
|
|
296
309
|
| `ciNodeOptions` | `Seq[String]` | `Seq.empty` | Sets `NODE_OPTIONS` when non-empty |
|
|
297
310
|
| `ciConcurrency` | `Option[Concurrency]` | one run per branch, cancelling in progress | Concurrency group, or `None` to omit the block |
|
|
311
|
+
| `ciWorkflowPermissions` | `Option[Map[String, String]]` | `Some(id-token: write, contents: read)` | Workflow-level `permissions`. `None` omits the block, so the workflow runs with the repository's default token permissions; `Some(Map.empty)` instead renders `permissions: {}`, which grants nothing |
|
|
298
312
|
| `ciSwapSizeGB` | `Int` | `0` | Adds a swap-space step to every job when greater than zero |
|
|
299
313
|
| `ciBackgroundJobs` | `Seq[String]` | `Seq.empty` | Commands prefixed to each `run`, for daemons a job needs |
|
|
300
314
|
| `ciEnableDeployPreview` | `Boolean` | `false` | Adds website-artifact upload steps to `build` and generates `deploy-preview.yml`. Requires `NETLIFY_AUTH_TOKEN`/`NETLIFY_SITE_ID` secrets |
|
|
@@ -311,6 +325,7 @@ All settings are `ThisBuild`-scoped.
|
|
|
311
325
|
| `ciScalaStewardWorkflowEnv` | `Map[String, String]` | `Map.empty` | Extra env vars for the scala-steward job |
|
|
312
326
|
| `ciScalaStewardConfig` | `ScalaStewardConfig` | `ScalaStewardConfig()` | Settings scaffolded into `.scala-steward.conf` on first non-empty render |
|
|
313
327
|
| `ciEnableDependabot` | `Boolean` | `true` | Generates `.github/dependabot.yml`. Overwrites a hand-written one when on; when off, only deletes a copy it generated itself |
|
|
328
|
+
| `ciEnableRegenerateWorkflows` | `Boolean` | `true` | Generates `regenerate-workflows.yml`, which re-runs `ciGenerateGithubWorkflow` on bot PRs and pushes the result to the PR branch. When off, only deletes a copy it generated itself |
|
|
314
329
|
| `ciDependabotConfig` | `DependabotConfig` | one weekly `github-actions` update at `/` | Content of the generated `dependabot.yml` |
|
|
315
330
|
|
|
316
331
|
**Test matrix**
|
|
@@ -332,6 +347,7 @@ All settings are `ThisBuild`-scoped.
|
|
|
332
347
|
| `ciLintJobs` | `Seq[Job]` | one `lint` job | |
|
|
333
348
|
| `ciTestJobs` | `Seq[Job]` | one `test` job | |
|
|
334
349
|
| `ciUpdateReadmeJobs` | `Seq[Job]` | one `update-readme` job | Set to `Seq.empty` if the README is maintained by hand |
|
|
350
|
+
| `ciReportSuccessfulJobs` | `Seq[Job]` | the aggregate `ci` job | Set to `Seq.empty` for a workflow made up entirely of custom jobs that does not want one |
|
|
335
351
|
| `ciReleaseJobs` | `Seq[Job]` | one `release` job | |
|
|
336
352
|
| `ciPostReleaseJobs` | `Seq[Job]` | `release-docs`, `notify-docs-release` | |
|
|
337
353
|
| `ciPullRequestApprovalJobs` | `Seq[String]` | the ids of `ciLintJobs`, `ciTestJobs` and `ciBuildJobs` | Job ids the aggregate `ci` job waits on. Follows the jobs those three settings produce, so renaming or adding one is picked up without touching this |
|
|
@@ -354,7 +370,7 @@ All settings are `ThisBuild`-scoped.
|
|
|
354
370
|
|
|
355
371
|
| Task | Description |
|
|
356
372
|
| --- | --- |
|
|
357
|
-
| `ciGenerateGithubWorkflow` | Writes `ci.yml`, `auto-approve.yml` and `auto-merge.yml`, plus `deploy-preview.yml` when `ciEnableDeployPreview` is `true` and `release-drafter.yml` (and scaffolds `.github/release-drafter.yml` once) when `ciEnableReleaseDrafter` is `true`, and scala-steward.yml (and scaffolds .scala-steward.conf once, when ciScalaStewardConfig renders non-empty content) when ciEnableScalaSteward is true,
|
|
373
|
+
| `ciGenerateGithubWorkflow` | Writes `ci.yml`, `auto-approve.yml` and `auto-merge.yml`, plus `deploy-preview.yml` when `ciEnableDeployPreview` is `true` and `release-drafter.yml` (and scaffolds `.github/release-drafter.yml` once) when `ciEnableReleaseDrafter` is `true`, and scala-steward.yml (and scaffolds .scala-steward.conf once, when ciScalaStewardConfig renders non-empty content) when ciEnableScalaSteward is true, `.github/dependabot.yml` when `ciEnableDependabot` is `true`, and `regenerate-workflows.yml` when `ciEnableRegenerateWorkflows` is `true` |
|
|
358
374
|
| `ciCheckGithubWorkflow` | Regenerates and fails if the committed files are stale |
|
|
359
375
|
| `ciGenerateAutoApproveWorkflow` | Writes `auto-approve.yml` only |
|
|
360
376
|
| `ciGenerateAutoMergeWorkflow` | Writes `auto-merge.yml` only |
|
|
@@ -411,6 +427,19 @@ ciPullRequestApprovalJobs := Seq("lint", "integration-test")
|
|
|
411
427
|
|
|
412
428
|
`Checkout`, `SetupLibuv`, `SetupJava(version)`, `SetupSBT`, `CacheDependencies`, `SetupNodeJs` and `SetSwapSpace` are all available; the ones defined as settings need `.value`.
|
|
413
429
|
|
|
430
|
+
### A Workflow of Only Custom Jobs
|
|
431
|
+
|
|
432
|
+
A build that replaces every stock job, for instance one whose jobs are generated from its module list, can also drop the two things the plugin adds around them: the aggregate `ci` job, and the workflow-level `permissions` block.
|
|
433
|
+
|
|
434
|
+
```scala
|
|
435
|
+
ciReportSuccessfulJobs := Seq.empty // no aggregate `ci` job
|
|
436
|
+
ciWorkflowPermissions := None // inherit the repository's default token permissions
|
|
437
|
+
ciConcurrency := None
|
|
438
|
+
ciWorkflowEnv := Map.empty
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
Omit `permissions` when a job needs more than the default `contents: read`, such as one that pushes a release tag with `GITHUB_TOKEN`. `None` is not the same as `Some(Map.empty)`, which renders `permissions: {}` and grants the token nothing.
|
|
442
|
+
|
|
414
443
|
### Job Timeouts
|
|
415
444
|
|
|
416
445
|
A job with no timeout inherits GitHub's default of six hours, which is a long time to wait for a hung build:
|
|
@@ -499,7 +528,7 @@ ZIO SBT Source is a Scala 2.13 + Scala 3 cross-compiled library that provides ut
|
|
|
499
528
|
Add the following line to your `libraryDependencies` in `build.sbt`:
|
|
500
529
|
|
|
501
530
|
```scala
|
|
502
|
-
libraryDependencies += "dev.zio" %% "zio-sbt-source" % "0.8.
|
|
531
|
+
libraryDependencies += "dev.zio" %% "zio-sbt-source" % "0.8.6"
|
|
503
532
|
```
|
|
504
533
|
|
|
505
534
|
### Features
|