Skip to content

Commit

Permalink
Merge pull request #29 from tarao/release-flow
Browse files Browse the repository at this point in the history
Release flow
  • Loading branch information
tarao authored Nov 9, 2023
2 parents 6734edc + 49d912a commit 66c93c1
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 10 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
17 changes: 8 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
import ProjectKeys._
import Implicits._

ThisBuild / tlBaseVersion := "0.9"

ThisBuild / projectName := "record4s"
ThisBuild / groupId := "com.github.tarao"
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(
tlGitHubDev("tarao", "INA Lintaro"),
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"
Expand Down Expand Up @@ -50,7 +47,6 @@ lazy val compileSettings = Def.settings(
)

lazy val commonSettings = Def.settings(
metadataSettings,
compileSettings,
initialCommands := s"""
import ${rootPkg.value}.*
Expand All @@ -72,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,
),
Expand Down Expand Up @@ -131,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")),
)
1 change: 0 additions & 1 deletion version.sbt

This file was deleted.

0 comments on commit 66c93c1

Please sign in to comment.