From 3324300981488de3679e60c77aeba8ace49eb2b8 Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Wed, 26 Jul 2023 10:59:16 +0200 Subject: [PATCH] Prepare for open-sourcing --- .github/workflows/ci.yml | 26 ++++++++++++++++-------- build.sbt | 43 +++++----------------------------------- 2 files changed, 23 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d7e9f60..5c830f00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -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 @@ -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 diff --git a/build.sbt b/build.sbt index 817b7933..6e1ca79d 100644 --- a/build.sbt +++ b/build.sbt @@ -12,6 +12,7 @@ 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 @@ -19,20 +20,10 @@ 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 { @@ -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 } } @@ -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 = @@ -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) @@ -140,7 +111,6 @@ lazy val core = crossProject(JVMPlatform) }, mimaBinaryIssueFilters ++= Nil ) - .disablePlugins(TypelevelCiSigningPlugin, Sonatype, SbtGpg) lazy val prometheus = crossProject(JVMPlatform) .withoutSuffixFor(JVMPlatform) @@ -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) @@ -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 := {