Skip to content

Commit

Permalink
Prepare for open-sourcing
Browse files Browse the repository at this point in the history
  • Loading branch information
hamnis committed Jul 26, 2023
1 parent 73ae473 commit 3324300
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 46 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ on:
tags: [v*]

env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
Expand Down Expand Up @@ -76,9 +81,6 @@ jobs:

- name: Check binary compatibility
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
env:
MYGET_USERNAME: ${{ secrets.PLATTFORM_MYGET_ENTERPRISE_READ_ID }}
MYGET_PASSWORD: ${{ secrets.PLATTFORM_MYGET_ENTERPRISE_READ_SECRET }}
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues

- name: Generate API documentation
Expand Down Expand Up @@ -173,8 +175,16 @@ jobs:
tar xf targets.tar
rm targets.tar
- name: Publish project
env:
MYGET_USERNAME: ${{ secrets.PLATTFORM_MYGET_ENTERPRISE_WRITE_ID }}
MYGET_PASSWORD: ${{ secrets.PLATTFORM_MYGET_ENTERPRISE_WRITE_SECRET }}
run: sbt +publish
- name: Import signing key
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
run: echo $PGP_SECRET | base64 -di | gpg --import

- name: Import signing key and strip passphrase
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
run: |
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
(echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)
- name: Publish
run: sbt tlCiRelease
43 changes: 5 additions & 38 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,18 @@ ThisBuild / developers := List(
tlGitHubDev("oyvindberg", "Øyvind Raddum Berg"),
tlGitHubDev("lysebraate", "Alfred Sandvik Lysebraate"),
tlGitHubDev("HenningKoller", "Henning Grimeland Koller"),
tlGitHubDev("ingararb", "Ingar Abrahamsen"),
tlGitHubDev("hamnis", "Erlend Hamnaberg")
)
ThisBuild / tlCiHeaderCheck := false
ThisBuild / tlCiScalafmtCheck := true

// publish website from this branch
//ThisBuild / tlSitePublishBranch := Some("main")
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")

ThisBuild / githubWorkflowPublishTargetBranches :=
Seq(RefPredicate.StartsWith(Ref.Tag("v")))

ThisBuild / githubWorkflowPublish := Seq(
WorkflowStep.Sbt(
commands = List("+publish"),
name = Some("Publish project"),
env = Map(
"MYGET_USERNAME" -> "${{ secrets.PLATTFORM_MYGET_ENTERPRISE_WRITE_ID }}",
"MYGET_PASSWORD" -> "${{ secrets.PLATTFORM_MYGET_ENTERPRISE_WRITE_SECRET }}"
)
)
)
ThisBuild / githubWorkflowBuild := {
val list = (ThisBuild / githubWorkflowBuild).value
list.collect {
Expand All @@ -41,11 +32,6 @@ ThisBuild / githubWorkflowBuild := {
"BIGQUERY_SERVICE_ACCOUNT" -> "${{secrets.BIGQUERY_SERVICE_ACCOUNT}}",
"ASSERT_CURRENT_GENERATED_FILES" -> "1"
))
case step: WorkflowStep.Sbt if step.name.contains("Check binary compatibility") =>
step.copy(env = Map(
"MYGET_USERNAME" -> "${{ secrets.PLATTFORM_MYGET_ENTERPRISE_READ_ID }}",
"MYGET_PASSWORD" -> "${{ secrets.PLATTFORM_MYGET_ENTERPRISE_READ_SECRET }}"
))
case s => s
}
}
Expand All @@ -55,28 +41,14 @@ val Scala213 = "2.13.11"
ThisBuild / crossScalaVersions := Seq(Scala213, Scala212, "3.3.0")
ThisBuild / scalaVersion := Scala213 // the default Scala
ThisBuild / tlVersionIntroduced := Map(
"2.12" -> "0.1.1",
"3" -> "0.1.1",
"2.13" -> "0.1.0"
"2.12" -> "0.9.0",
"3" -> "0.9.0",
"2.13" -> "0.9.0"
)

val commonSettings = Seq(
resolvers += "MyGet - datahub".at(s"https://nrk.myget.org/F/datahub/maven/"),
Compile / headerSources := Nil,
Test / headerSources := Nil,
publishTo := {
val MyGet = "https://nrk.myget.org/F/datahub/maven/"
if (isSnapshot.value) None else Some("releases".at(MyGet))
},
credentials ++= {
(sys.env.get("MYGET_USERNAME"), sys.env.get("MYGET_PASSWORD")) match {
case (Some(username), Some(password)) =>
List(
Credentials("MyGet - datahub", "nrk.myget.org", username, password)
)
case _ => Nil
}
},
scalacOptions -= "-source:3.0-migration",
scalacOptions ++= {
val compilerWarnings =
Expand All @@ -95,7 +67,6 @@ val commonSettings = Seq(
lazy val root = tlCrossRootProject
.settings(name := "bigquery-scala")
.aggregate(core, testing, prometheus, docs)
.disablePlugins(TypelevelCiSigningPlugin, Sonatype, SbtGpg)

lazy val core = crossProject(JVMPlatform)
.withoutSuffixFor(JVMPlatform)
Expand Down Expand Up @@ -140,7 +111,6 @@ lazy val core = crossProject(JVMPlatform)
},
mimaBinaryIssueFilters ++= Nil
)
.disablePlugins(TypelevelCiSigningPlugin, Sonatype, SbtGpg)

lazy val prometheus = crossProject(JVMPlatform)
.withoutSuffixFor(JVMPlatform)
Expand All @@ -154,7 +124,6 @@ lazy val prometheus = crossProject(JVMPlatform)
"io.prometheus" % "simpleclient" % "0.16.0"
)
)
.disablePlugins(TypelevelCiSigningPlugin, Sonatype, SbtGpg)

lazy val testing = crossProject(JVMPlatform)
.withoutSuffixFor(JVMPlatform)
Expand All @@ -170,13 +139,11 @@ lazy val testing = crossProject(JVMPlatform)
),
mimaBinaryIssueFilters ++= Nil
)
.disablePlugins(TypelevelCiSigningPlugin, Sonatype, SbtGpg)

lazy val docs = project
.in(file("site"))
// .enablePlugins(TypelevelSitePlugin)
.enablePlugins(MdocPlugin, NoPublishPlugin)
.disablePlugins(TypelevelCiSigningPlugin, Sonatype, SbtGpg)
.dependsOn(core.jvm, testing.jvm)
.settings(
compile := {
Expand Down

0 comments on commit 3324300

Please sign in to comment.