Skip to content

Commit

Permalink
Target JDK 1.8 and use sbt-github-actions for snapshot publish
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed Feb 14, 2024
1 parent 0d0a247 commit c87feaf
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 58 deletions.
82 changes: 64 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
scala: [2.12.18]
java: [temurin@11, temurin@17, temurin@21]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Ignore line ending differences in git
Expand All @@ -45,33 +45,79 @@ jobs:
with:
fetch-depth: 0

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
java-version: 8
cache: sbt

- name: Setup Java (temurin@17)
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v4
- name: Check that workflows are up to date
shell: bash
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck

- shell: bash
run: sbt '++ ${{ matrix.scala }}' test scripted

- name: Compress target directories
shell: bash
run: tar cf targets.tar target theme/target plugin/target project/target

- name: Upload target directories
uses: actions/upload-artifact@v4
with:
distribution: temurin
java-version: 17
cache: sbt
name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
path: targets.tar

publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main')
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.18]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Ignore line ending differences in git
if: contains(runner.os, 'windows')
run: git config --global core.autocrlf false

- name: Setup Java (temurin@21)
if: matrix.java == 'temurin@21'
- name: Configure pagefile for Windows
if: contains(runner.os, 'windows')
uses: al-cheb/[email protected]
with:
minimum-size: 2GB
maximum-size: 8GB
disk-root: 'C:'

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
java-version: 8
cache: sbt

- name: Check that workflows are up to date
shell: bash
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
- name: Download target directories (2.12.18)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-2.12.18-${{ matrix.java }}

- shell: bash
run: sbt '++ ${{ matrix.scala }}' test scripted
- name: Inflate target directories (2.12.18)
run: |
tar xf targets.tar
rm targets.tar
- name: Publish project
env:
NEXUS_USER: ${{ secrets.NEXUS_USER }}
NEXUS_PW: ${{ secrets.NEXUS_PW }}
run: sbt publish
33 changes: 0 additions & 33 deletions .github/workflows/publish.yml

This file was deleted.

21 changes: 15 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@

import net.bzzt.reproduciblebuilds.ReproducibleBuildsPlugin.reproducibleBuildsCheckResolver

scalaVersion := "2.13.11"
val scala212 = "2.12.18"

ThisBuild / scalaVersion := scala212
ThisBuild / crossScalaVersions := Seq(scala212)

ThisBuild / apacheSonatypeProjectProfile := "pekko"
ThisBuild / dynverSonatypeSnapshots := true
Expand Down Expand Up @@ -88,12 +91,18 @@ lazy val pekkoPlugin = project
ThisBuild / githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("test", "scripted")))

ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches := Seq()
ThisBuild / githubWorkflowPublish := Seq()
ThisBuild / githubWorkflowPublishTargetBranches := Seq(
RefPredicate.Equals(Ref.Branch("main")))

ThisBuild / githubWorkflowPublish := Seq(
WorkflowStep.Sbt(
commands = List("publish"),
name = Some("Publish project"),
env = Map(
"NEXUS_USER" -> "${{ secrets.NEXUS_USER }}",
"NEXUS_PW" -> "${{ secrets.NEXUS_PW }}")))

ThisBuild / githubWorkflowOSes := Seq("ubuntu-latest", "macos-latest", "windows-latest")

ThisBuild / githubWorkflowJavaVersions := Seq(
JavaSpec.temurin("11"),
JavaSpec.temurin("17"),
JavaSpec.temurin("21"))
JavaSpec.temurin("8"))
3 changes: 2 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

// When updating the sbt-paradox version,
// remember to also update build.sbt
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-theme" % "0.10.6")
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-theme" % "0.9.2")
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.9.2")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("org.mdedetrich" % "sbt-apache-sonatype" % "0.1.10")
Expand Down

0 comments on commit c87feaf

Please sign in to comment.