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 55931ab commit 95bbb13
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 94 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/publish.yml

This file was deleted.

64 changes: 31 additions & 33 deletions .github/workflows/sbt-build.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
name: Build & Publish

name: CI/CD Pipeline for SBT
on:
workflow_dispatch:
push:
branches: ['master']

push:
branches:
- maven-central # Trigger on push to the main branch
jobs:
Build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4

- name: Setup JDK And SBT
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
cache: "sbt"

- 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: Publish to GitHub Packages
run: sbt publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- 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 }}
80 changes: 47 additions & 33 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,40 +1,54 @@
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")
)
)
))

pomIncludeRepository := { _ => false }
// 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(
"GitHub Package Registry",
"maven.pkg.github.com",
"cdcgov",
System.getenv("GITHUB_TOKEN")
"Sonatype Nexus Repository Manager",
"oss.sonatype.org",
sys.env.getOrElse("SONATYPE_USERNAME", ""),
sys.env.getOrElse("SONATYPE_PASSWORD", "")
)
publishMavenStyle := true

credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
// 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>
)

publishMavenStyle := true
// 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>
)

version := "1.2.10"
scalaVersion := "2.13.13"
// 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")

mainClass := Some("gov.cdc.hl7pet.DeIdentifierApp")
Global / excludeLintKeys += mainClass
Expand All @@ -50,4 +64,4 @@ libraryDependencies += "com.google.code.gson" % "gson" % "2.10.1"

crossPaths:= true

publishArtifact in (Compile, packageSrc) := true
publishArtifact in (Compile, packageSrc) := true
6 changes: 5 additions & 1 deletion 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")
//addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.6.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-pom-reader" % "1.2.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-sonatype" % "3.9.8")

0 comments on commit 95bbb13

Please sign in to comment.