Skip to content

Commit

Permalink
github action release
Browse files Browse the repository at this point in the history
  • Loading branch information
rafafrdz committed Feb 22, 2024
1 parent b2ee9b4 commit 5e5bc25
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 85 deletions.
24 changes: 8 additions & 16 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
name: Publish Artifact on Release
name: Release
on:
release:
types: [ created ]

push:
branches: [ master, main ]
tags: [ "*" ]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK
uses: actions/setup-java@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
cache: sbt

- name: Clean
run: sbt clean

- name: Publish
run: sbt publishSigned
- run: sbt ci-release
env:
PGP_KEY_IDENTIFIER: ${{ secrets.PGP_KEY_IDENTIFIER }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
2 changes: 0 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,3 @@ lazy val examples: Project =
name := "examples"
)
.dependsOn(core, sql)

// See https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html for instructions on how to publish to Sonatype.
33 changes: 0 additions & 33 deletions project/Publish.scala

This file was deleted.

4 changes: 1 addition & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.15")
//addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.9")
29 changes: 1 addition & 28 deletions publish.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Publish.refFromTag
import xerial.sbt.Sonatype.*

ThisBuild / organization := "io.github.rafafrdz"
Expand All @@ -25,43 +24,17 @@ ThisBuild / developers := List(
ThisBuild / description := "A simple DSL to create criterias for filtering data in Scala."
ThisBuild / licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
ThisBuild / publish / skip := true
ThisBuild / publishMavenStyle := true
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / pomIncludeRepository := { _ => false }

/** Reference the project OSS repository */
// Repository for releases on Maven Central using Sonatype
ThisBuild / publishTo := sonatypePublishToBundle.value
ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org"
ThisBuild / sonatypeRepository := nexusRepositoryFromTag("https://s01.oss.sonatype.org/")
ThisBuild / sonatypeRepository := "https://s01.oss.sonatype.org/service/local"
ThisBuild / sonatypeProjectHosting := Some(
GitHubHosting(
user = "rafafrdz",
repository = "criterial-dsl",
email = "[email protected]"
)
)

ThisBuild / credentials += Credentials(
"Sonatype Nexus Repository Manager",
"s01.oss.sonatype.org",
sys.env.getOrElse("SONATYPE_USERNAME", ""),
sys.env.getOrElse("SONATYPE_PASSWORD", "")
)

ThisBuild / credentials += Credentials(
"GnuPG Key ID",
"gpg",
sys.env.getOrElse("PGP_KEY_IDENTIFIER", ""),
sys.env.getOrElse("PGP_SECRET", "")
)

def nexusRepositoryFromTag(nexus: String): String =
refFromTag
.flatMap { t =>
t.headOption.map {
case 'v' => nexus + "service/local/staging/deploy/maven2/"
case _ => nexus + "content/repositories/snapshots/"
}
}
.getOrElse(nexus + "content/repositories/snapshots/")
3 changes: 0 additions & 3 deletions version.sbt

This file was deleted.

0 comments on commit 5e5bc25

Please sign in to comment.