Skip to content

Commit

Permalink
Maven central (#10)
Browse files Browse the repository at this point in the history
* updated the files

* updated the files

* updated the files

* updated the files

* updated the files

* updated the files

* updated the files

* updated the files

* updated the files

* updated the files

* updated yml file with version

* updated yml file with version
  • Loading branch information
ucf4 authored Sep 10, 2024
1 parent c1f6b45 commit 78c94b5
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 86 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/publish.yml

This file was deleted.

52 changes: 27 additions & 25 deletions .github/workflows/sbt-build.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
name: Build & Publish
name: Release

on:
workflow_dispatch:
push:
branches: ['master']

tags:
- 'v*.*.*' # Adjust the tag pattern to match your versioning scheme
release:
types: [created] # Trigger the workflow when a release is created
jobs:
Build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: sbt

- name: Install gnupg
run: sudo apt update && sudo apt install -y gnupg

- name: Setup JDK And SBT
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
cache: "sbt"
- name: Import PGP secret
run: echo "${{ secrets.PGP_SECRET }}" | base64 --decode | gpg --batch --import

- name: Publish to Maven Repository
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
PGP_SECRET: ${{ secrets.GPG_PRIVATE_KEY }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
- name: Refresh version tag
run: git pull --tags

- name: Publish to GitHub Packages
run: sbt publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Maven Repository
run: sbt clean publishSigned sonatypeBundleRelease
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
77 changes: 46 additions & 31 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,39 +1,55 @@
inThisBuild(List(
name:= "HL7-PET",
organization := "gov.cdc.hl7",
organizationName:= "CDC",
homepage := Some(url("https://github.com/cdcent/hl7-pet")),
description := "This project is a library to Parse HL7 v2 messages",
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
scmInfo:= Some (
ScmInfo(
url("https://github.com/cdcgov/hl7-pet"),
"scm:[email protected]/cdcgov/hl7-pet.git"
)
),
developers := List(
Developer(
id="mcq1",
name="Marcelo Caldas",
email = "[email protected]",
url = url ("https://github.com/cdcent/hl7-pet")
)

inThisBuild(
List(
organization := "gov.cdc",
organizationName:= "CDC",
)
))
)

pomIncludeRepository := { _ => false }
credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
"cdcgov",
System.getenv("GITHUB_TOKEN")
// Repository for releases on Maven Central using Sonatype
publishTo := sonatypePublishToBundle.value
publishMavenStyle := true

sonatypeProfileName := "gov.cdc" // Your sonatype groupID
// Reference the project OSS repository

import xerial.sbt.Sonatype.GitHubHosting
sonatypeProjectHosting := Some(
GitHubHosting(user = "mscaldas2012", repository = "hl7-pet", email = "[email protected]")
)

licenses:= Seq(
"APL2" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt"))

homepage := Some(url("https://cdc.gov"))

scmInfo := Some(
ScmInfo(
url("https://github.com/cdcgov/hl7-pet"),
"scm:[email protected]/cdcgov/hl7-pet.git"
)
)

credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
sonatypeRepository := {
val nexus = "https://s01.oss.sonatype.org/"
if (isSnapshot.value) nexus + "content/repositories/snapshots"
else nexus + "service/local"
}

import xerial.sbt.Sonatype.sonatypeCentralHost
ThisBuild / sonatypeCredentialHost := sonatypeCentralHost
ThisBuild / sonatypeRepository := "https://s01.oss.sonatype.org/service/local"
//credentials += Credentials(Path.userHome / ".sbt" / "sonatype_credentials")
//publishTo := Some("Maven Central" at "https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials += Credentials(
"Sonatype Nexus Repository Manager",
"oss.sonatype.org",
sys.env.getOrElse("SONATYPE_USERNAME", ""),
sys.env.getOrElse("SONATYPE_PASSWORD", "")
)
publishMavenStyle := true

version := "1.2.10"
version := "1.2.11"
scalaVersion := "2.13.13"

mainClass := Some("gov.cdc.hl7pet.DeIdentifierApp")
Expand All @@ -49,5 +65,4 @@ libraryDependencies += "com.fasterxml.jackson.module" % "jackson-modules-base" %
libraryDependencies += "com.google.code.gson" % "gson" % "2.10.1"

crossPaths:= true

publishArtifact in (Compile, packageSrc) := true

10 changes: 7 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3")
// sbt 1 only, see FAQ for 0.13 support
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.6.0")
unmanagedSourceDirectories.in(Compile) +=
baseDirectory.in(ThisBuild).value.getParentFile /
"plugin" / "src" / "main" / "scala"
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1")
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.11.3")

0 comments on commit 78c94b5

Please sign in to comment.