From ef9574c0252d66100c4571ffa7a5e8039a4556e7 Mon Sep 17 00:00:00 2001 From: tarao Date: Thu, 9 Nov 2023 12:55:14 +0900 Subject: [PATCH 1/3] Give version by sbt-typelevel. --- build.sbt | 2 ++ version.sbt | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) delete mode 100644 version.sbt diff --git a/build.sbt b/build.sbt index 9ad188d..438d802 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,8 @@ import ProjectKeys._ import Implicits._ +ThisBuild / tlBaseVersion := "0.9" + ThisBuild / projectName := "record4s" ThisBuild / groupId := "com.github.tarao" ThisBuild / rootPkg := "${groupId.value}.${projectName.value}" diff --git a/version.sbt b/version.sbt deleted file mode 100644 index e91862e..0000000 --- a/version.sbt +++ /dev/null @@ -1 +0,0 @@ -ThisBuild / version := "0.1.0-SNAPSHOT" From 3706ae2fca3ba66359acd119f955794e0b003e8b Mon Sep 17 00:00:00 2001 From: tarao Date: Thu, 9 Nov 2023 12:55:37 +0900 Subject: [PATCH 2/3] Clean up metadata settings. --- build.sbt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index 438d802..f7849ab 100644 --- a/build.sbt +++ b/build.sbt @@ -9,6 +9,7 @@ ThisBuild / rootPkg := "${groupId.value}.${projectName.value}" ThisBuild / organization := groupId.value ThisBuild / organizationName := "record4s authors" +ThisBuild / homepage := Some(url("https://github.com/tarao/record4s")) ThisBuild / startYear := Some(2023) ThisBuild / licenses := Seq(License.MIT) ThisBuild / developers := List( @@ -16,12 +17,6 @@ ThisBuild / developers := List( tlGitHubDev("windymelt", "Windymelt"), ) -lazy val metadataSettings = Def.settings( - organization := groupId.value, - description := "Extensible records for Scala", - homepage := Some(url("https://github.com/tarao/record4s")), -) - val Scala_3 = "3.3.1" val Scala_2_13 = "2.13.12" val Scala_2_11 = "2.11.12" @@ -52,7 +47,6 @@ lazy val compileSettings = Def.settings( ) lazy val commonSettings = Def.settings( - metadataSettings, compileSettings, initialCommands := s""" import ${rootPkg.value}.* @@ -74,6 +68,7 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform) .asModuleWithoutSuffix .settings(commonSettings) .settings( + description := "Extensible records for Scala", libraryDependencies ++= Seq( "org.scalatest" %%% "scalatest" % scalaTestVersion % Test, ), From 49d912a12d60e20d57dda71ce66f55b8f1b8d14d Mon Sep 17 00:00:00 2001 From: tarao Date: Thu, 9 Nov 2023 14:06:41 +0900 Subject: [PATCH 3/3] Set up CI release. --- .github/workflows/ci.yml | 123 +++++++++++++++++++++++++++++++++++++++ build.sbt | 6 +- 2 files changed, 127 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3fb957..881490a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,6 +113,129 @@ jobs: if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest' run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc + - name: Make target directories + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master') + run: mkdir -p modules/core/.native/target modules/core/.js/target modules/circe/.js/target modules/circe/.jvm/target modules/circe/.native/target modules/core/.jvm/target project/target + + - name: Compress target directories + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master') + run: tar cf targets.tar modules/core/.native/target modules/core/.js/target modules/circe/.js/target modules/circe/.jvm/target modules/circe/.native/target modules/core/.jvm/target project/target + + - name: Upload target directories + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master') + uses: actions/upload-artifact@v3 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }} + path: targets.tar + + publish: + name: Publish Artifacts + needs: [build] + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master') + strategy: + matrix: + os: [ubuntu-latest] + java: [temurin@8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Java (temurin@8) + id: setup-java-temurin-8 + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 8 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: sbt +update + + - name: Setup Java (temurin@11) + id: setup-java-temurin-11 + if: matrix.java == 'temurin@11' + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 11 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false' + run: sbt +update + + - name: Setup Java (temurin@17) + id: setup-java-temurin-17 + if: matrix.java == 'temurin@17' + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: sbt +update + + - name: Download target directories (3, rootJS) + uses: actions/download-artifact@v3 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJS + + - name: Inflate target directories (3, rootJS) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (3, rootJVM) + uses: actions/download-artifact@v3 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJVM + + - name: Inflate target directories (3, rootJVM) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (3, rootNative) + uses: actions/download-artifact@v3 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootNative + + - name: Inflate target directories (3, rootNative) + run: | + tar xf targets.tar + rm targets.tar + + - name: Import signing key + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + run: echo $PGP_SECRET | base64 -d -i - | gpg --import + + - name: Import signing key and strip passphrase + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != '' + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + run: | + echo "$PGP_SECRET" | base64 -d -i - > /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 + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} + run: sbt tlCiRelease + dependency-submission: name: Submit Dependencies if: github.event_name != 'pull_request' diff --git a/build.sbt b/build.sbt index f7849ab..393d286 100644 --- a/build.sbt +++ b/build.sbt @@ -128,5 +128,7 @@ lazy val benchmark_2_11 = (project in file("modules/benchmark_2_11")) ), ) -ThisBuild / githubWorkflowTargetBranches := Seq("master") -ThisBuild / githubWorkflowPublishTargetBranches := Seq() +ThisBuild / githubWorkflowTargetBranches := Seq("master") +ThisBuild / githubWorkflowPublishTargetBranches := Seq( + RefPredicate.Equals(Ref.Branch("master")), +)