Skip to content

Commit

Permalink
Add publishing configuration to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
susuro committed Dec 29, 2023
1 parent 21c5821 commit 9b2c7af
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
40 changes: 33 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]

jobs:

validate:
build:
name: Compile and test
runs-on: ubuntu-latest

Expand All @@ -13,16 +13,42 @@ jobs:
uses: actions/checkout@v4

- name: Setup Java
id: setup-java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: sbt

- name: Update sbt
if: steps.setup-java.outputs.cache-hit == 'false'
run: sbt +update

- name: Compile, check formatting and test
run: sbt validate

- name: Gnerate API documentation
run: sbt doc

publish:
name: Publish artifacts
needs: [validate]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-latest

steps:

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

- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: sbt

- name: Release
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
10 changes: 10 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ lazy val basicSettings = Seq(
startYear := Some(2023),
name := "tyre-scala",
description := "Typed regex parser",
homepage := Some(url("https://github.com/kasiaMarek/tyre-scala")),
scalaVersion := "3.3.1"
)

Expand All @@ -25,6 +26,7 @@ lazy val root = (project in file("."))
Compile / console / scalacOptions --= Seq("-Xfatal-warnings"),
semanticdbEnabled := true
)
.settings(publishSettings: _*)

lazy val scalacSettings = Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
Expand All @@ -42,3 +44,11 @@ lazy val scalacSettings = Seq(
"-Xverify-signatures", // Verify generic signatures in generated bytecode.
"-Ykind-projector:underscores" // require ? as type parametr wildcards and _ as placeholder
)

lazy val publishSettings = Seq(
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
developers := List(
Developer("kasiaMarek", "Katarzyna Marek", "kasia@marek.net", url("https://github.com/kasiaMarek")),
Developer("susuro", "Robert Marek", "robert@marek.net", url("https://github.com/susuro"))
)
)
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")

0 comments on commit 9b2c7af

Please sign in to comment.