Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ on:
branches: ['**', '!update/**', '!pr/**']
tags: [v*]

permissions:
actions: none
checks: none
contents: write
deployments: none
id-token: none
issues: none
packages: read
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down Expand Up @@ -164,6 +178,22 @@ jobs:
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
run: sbt tlCiRelease

- name: Start up Postgres for docs publish
if: startsWith(github.ref, 'refs/tags/v')
run: docker compose up -d

- name: Configure git for docs publish
if: startsWith(github.ref, 'refs/tags/v')
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Publish Doc Site
if: startsWith(github.ref, 'refs/tags/v')
env:
SBT_GHPAGES_COMMIT_MESSAGE: Update docs for ${{ github.ref_name }}
run: sbt docs/makeSite docs/ghpagesPushSite

dependency-submission:
name: Submit Dependencies
if: github.event.repository.fork == false && github.event_name != 'pull_request'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ jobs:
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin gh-pages:gh-pages
git worktree add doc_worktree gh-pages
git fetch origin gh-pages:refs/remotes/origin/gh-pages
git worktree add --track -B gh-pages doc_worktree origin/gh-pages

- name: Publish docs
env:
Expand Down
38 changes: 37 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import FreeGen2._
import scala.sys.process._
import org.typelevel.sbt.gha.{PermissionValue, Permissions}
import org.typelevel.sbt.tpolecat.{DevMode, CiMode}

// Library versions all in one place, for convenience and sanity.
Expand Down Expand Up @@ -28,6 +29,18 @@ lazy val scala212Version = "2.12.21"
lazy val scala213Version = "2.13.18"
lazy val scala3Version = "3.3.8"
lazy val allScalaVersions = List(scala212Version, scala213Version, scala3Version)
lazy val doobieGitRemote =
if (sys.env.get("GITHUB_ACTIONS").contains("true"))
sys.env
.get("GITHUB_TOKEN")
.filter(_.nonEmpty)
.map(token => s"https://x-access-token:$token@github.com/typelevel/doobie.git")
.getOrElse("https://github.com/typelevel/doobie.git")
else
"git@github.com:typelevel/doobie.git"
lazy val doobieGithubWorkflowPermissions =
Permissions.Specify.defaultRestrictive
.withContents(PermissionValue.Write)
// scala-steward:off
lazy val slf4jVersion = "1.7.36"
// scala-steward:on
Expand All @@ -44,6 +57,8 @@ ThisBuild / developers += tlGitHubDev("tpolecat", "Rob Norris")
ThisBuild / tpolecatDefaultOptionsMode :=
(if (sys.env.contains("CI")) CiMode else DevMode)
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11"))
useReadableConsoleGit
ThisBuild / githubWorkflowPermissions := Some(doobieGithubWorkflowPermissions)
ThisBuild / githubWorkflowBuildPreamble ++= Seq(
WorkflowStep.Run(
commands = List("docker compose up -d"),
Expand Down Expand Up @@ -86,6 +101,27 @@ ThisBuild / githubWorkflowJobSetup ~= { steps =>
case s => s
}
}
ThisBuild / githubWorkflowPublishPostamble ++= Seq(
WorkflowStep.Run(
commands = List("docker compose up -d"),
name = Some("Start up Postgres for docs publish"),
cond = Some("startsWith(github.ref, 'refs/tags/v')")
),
WorkflowStep.Run(
commands = List(
"git config --global user.name \"github-actions[bot]\"",
"git config --global user.email \"41898282+github-actions[bot]@users.noreply.github.com\""
),
name = Some("Configure git for docs publish"),
cond = Some("startsWith(github.ref, 'refs/tags/v')")
),
WorkflowStep.Sbt(
commands = List("docs/makeSite", "docs/ghpagesPushSite"),
name = Some("Publish Doc Site"),
cond = Some("startsWith(github.ref, 'refs/tags/v')"),
env = Map("SBT_GHPAGES_COMMIT_MESSAGE" -> "Update docs for ${{ github.ref_name }}")
)
)

ThisBuild / mergifyPrRules += MergifyPrRule(
name = "merge-when-ci-pass",
Expand Down Expand Up @@ -576,7 +612,7 @@ lazy val docs = projectMatrix

// postgis is `provided` dependency for users, and section from book of doobie needs it
libraryDependencies += postgisDep,
git.remoteRepo := "git@github.com:typelevel/doobie.git",
git.remoteRepo := doobieGitRemote,
ghpagesNoJekyll := true,
publish / skip := true,
paradoxTheme := Some(builtinParadoxTheme("generic")),
Expand Down
Loading