Skip to content

Commit

Permalink
updated the files
Browse files Browse the repository at this point in the history
  • Loading branch information
ucf4 committed Sep 9, 2024
1 parent 7bd530f commit cf99bfa
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 82 deletions.
61 changes: 29 additions & 32 deletions .github/workflows/sbt-build.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,35 @@
name: CI/CD Pipeline for SBT
name: Release

on:
push:
branches:
- maven-central # Trigger on push to the main branch
push:
branches:
- maven-central
jobs:
Build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- 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: Import PGP secret
run: echo "${{ secrets.PGP_SECRET }}" | base64 --decode | gpg --batch --import

- name: Refresh version tag
run: git pull --tags

- name: Install JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: sbt
- name: Cache SBT dependencies
uses: actions/cache@v2
with:
path: |
~/.ivy2/cache
~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
restore-keys: |
${{ runner.os }}-sbt-
- name: Publish to Maven Central
run: sbt +publish
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
- name: Publish to Maven Repository
run: sbt clean ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
90 changes: 40 additions & 50 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,54 +1,33 @@
// Project name
name := "HL7-PET"

// Project version
version := "1.2.11"

// Scala version
scalaVersion := "2.13.13"

// Organization name (this will be used in the artifact coordinates)
organization := "gov.cdc"

// Credentials for publishing (make sure to replace with your actual 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

// Optional: Additional publishing settings
pomSettings := Seq(
pomExtra :=
<url>https://github.com/cdcgov/hl7-pet</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
</license>
</licenses>
<developers>
<developer>
<id>mcq1</id>
<name>Marcelo Caldas</name>
<url>https://github.com/cdcgov/hl7-pet</url>
</developer>
</developers>
inThisBuild(
List(
name:= "HL7-PET",
organization := "gov.cdc",
organizationName:= "CDC",
homepage := Some(url("https://github.com/cdcgov/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/cdcgov/hl7-pet")
)
)
)
)
ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org"
ThisBuild / sonatypeRepository := "https://oss.sonatype.org/service/local/staging/deploy/maven2/"

// Optional: Set Scala version in the POM file (if needed)
pomSettings += pomExtra := (
<scm>
<url>https://github.com/cdcgov/hl7-pet</url>
<connection>scm:git@github.com/cdcgov/hl7-pet.git</connection>
</scm>
)
publishMavenStyle := true

// Add plugin for SBT publishing (make sure to include this in project/plugins.sbt as well)
addSbtPlugin("com.typesafe.sbt" % "sbt-pom-reader" % "1.2.0")
scalaVersion := "2.13.13"

mainClass := Some("gov.cdc.hl7pet.DeIdentifierApp")
Global / excludeLintKeys += mainClass
Expand All @@ -62,6 +41,17 @@ libraryDependencies += "com.fasterxml.jackson.module" %% "jackson-module-scala"
libraryDependencies += "com.fasterxml.jackson.module" % "jackson-modules-base" % "2.17.0" pomOnly()
libraryDependencies += "com.google.code.gson" % "gson" % "2.10.1"

crossPaths:= true
Compile / packageSrc / publishArtifact := true

onLoadMessage := s"Welcome to sbt-ci-release ${version.value}"

publishArtifact in (Compile, packageSrc) := true
lazy val plugin = project
.enablePlugins(SbtPlugin)
.settings(
moduleName := "sbt-ci-release",
pluginCrossBuild / sbtVersion := "1.0.4",
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 cf99bfa

Please sign in to comment.