Skip to content

Commit

Permalink
feat: SKFP-905 deploy artefact to sonatype (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
celinepelletier authored Oct 18, 2024
1 parent 42ce27f commit fb27bb6
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 2 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/publish_artefact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish Artifact

on:
push:
tags:
- v*

jobs:
release:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.OSS_SONATYPE_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.OSS_SONATYPE_GPG_PASSPHRASE }}
git_user_signingkey: false

- name: Publish Artifact
shell: bash
env:
tag: ${{ github.ref_name }}
SONATYPE_REALM: $OSS_SONATYPE_REALM
SONATYPE_HOST: $OSS_SONATYPE_HOST
SONATYPE_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }}
run: |
export PGP_PASSPHRASE=${{ secrets.OSS_SONATYPE_GPG_PASSPHRASE }}
# Remove the leading 'v' from the tag string
export VERSION=${tag#v}
sbt 'publishSigned; sonatypeRelease'
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.3.13
sbt.version=1.6.2
5 changes: 4 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")

addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.0.15")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.13")
46 changes: 46 additions & 0 deletions publish.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
ThisBuild / sonatypeCredentialHost := sys.env.getOrElse("SONATYPE_HOST", "s01.oss.sonatype.org")
ThisBuild / credentials += sys.env.get("SONATYPE_USERNAME").map(username => Credentials(sys.env("SONATYPE_REALM"), sys.env("SONATYPE_HOST"), username, sys.env("SONATYPE_PASSWORD"))).getOrElse(Credentials(Path.userHome / ".sbt" / "sonatype_credentials"))
ThisBuild / releasePublishArtifactsAction := PgpKeys.publishSigned.value
ThisBuild / fork := true
ThisBuild / versionScheme := Some("semver-spec")
ThisBuild / organization := "bio.ferlab"
ThisBuild / organizationName := "ferlab"
ThisBuild / organizationHomepage := Some(url("https://github.com/Ferlab-Ste-Justine"))

ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/Ferlab-Ste-Justine/obo-parser"),
"scm:[email protected]:Ferlab-Ste-Justine/obo-parser.git"
)
)

ThisBuild / developers := List(
Developer(
id = "adipaul1981",
name = "Adrian Paul",
email = "[email protected]",
url = url("https://github.com/adipaul1981")
),
Developer(
id = "jecos",
name = "Jeremy Costanza",
email = "[email protected]",
url = url("https://github.com/jecos")
)
)
ThisBuild / description := "Library built on top of Apache Spark to speed-up data lakes development.."
ThisBuild / licenses := List("Apache 2" -> new URL("http://www.apache.org/licenses/LICENSE-2.0.txt"))
ThisBuild / homepage := Some(url("https://github.com/Ferlab-Ste-Justine/obo-parser"))

import sbt.url
import xerial.sbt.Sonatype._

ThisBuild / sonatypeProjectHosting := Some(GitHubHosting("Ferlab Ste-Justine", "obo-parser", "[email protected]"))
// Remove all additional repository other than Maven Central from POM
ThisBuild / pomIncludeRepository := { _ => false }
ThisBuild / publishTo := {
val nexus = "https://s01.oss.sonatype.org/"
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
ThisBuild / publishMavenStyle := true

0 comments on commit fb27bb6

Please sign in to comment.