Skip to content

Commit

Permalink
Build and pusblish artifact to maven and github (#9)
Browse files Browse the repository at this point in the history
* Build and pusblish artifact to maven and github

* Deactivate old workflow

---------

Co-authored-by: Seun Soyinka <ssoyinka@MacBook-Pro-2.local>
  • Loading branch information
Seun0925 and Seun Soyinka authored Aug 21, 2024
1 parent f2f407b commit 55931ab
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Publish Jar on Push to main

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

jobs:
publish:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/sbt-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build & Publish

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

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 }}
58 changes: 22 additions & 36 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
name:= "HL7-PET"

//githubOwner := "cdc.gov"
//githubRepository := "HL7-PET"
//githubTokenSource := TokenSource.Environment("GITHUB_TOKEN")


organization:= "gov.cdc.hl7"
organizationName:= "CDC"
scmInfo:= Some (
ScmInfo(
url("https://github.com/cdcgov/hl7-pet"),
"scm:git@github.com/cdcgov/hl7-pet.git"
)
)

developers := List(
Developer(
id="mcq1",
name="Marcelo Caldas",
email = "mcq1@cdc.com",
url = url ("https://github.com/cdcent/hl7-pet")
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:git@github.com/cdcgov/hl7-pet.git"
)
),
developers := List(
Developer(
id="mcq1",
name="Marcelo Caldas",
email = "mcq1@cdc.com",
url = url ("https://github.com/cdcent/hl7-pet")
)
)
)

description := "This project is a library to Parse HL7 v2 messages"
licenses := List("Apache 2" -> new URL("http://www.apache.org/licenses/LICENSE-2.0.txt"))
homepage := Some(url("https://github.com/cdcent/hl7-pet"))
))

pomIncludeRepository := { _ => false }

publishTo := Some("GitHub cdcgov Apache Maven Packages" at "https://maven.pkg.github.com/cdcgov/hl7-pet")
credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
Expand All @@ -42,9 +34,8 @@ credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
publishMavenStyle := true

version := "1.2.10"
scalaVersion:= "2.13.10"
scalaVersion := "2.13.13"

//mainClass in assembly := Some("gov.cdc.hl7pet.DeIdentifierApp")
mainClass := Some("gov.cdc.hl7pet.DeIdentifierApp")
Global / excludeLintKeys += mainClass

Expand All @@ -57,11 +48,6 @@ 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"

//assemblyMergeStrategy in assembly := {
// case PathList("META-INF", xs @ _*) => MergeStrategy.discard
// case x => MergeStrategy.first
//}

crossPaths:= true

publishArtifact in (Compile, packageSrc) := true
7 changes: 1 addition & 6 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
sbt.version=1.8.0
<<<<<<< HEAD
#sbt.version=1.0.0
=======
#sbt.version=1.0.4
>>>>>>> 78c370b53da9a444962a2178ee2c33f169faea8d
sbt.version=1.10.1
4 changes: 3 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
//addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3")
//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")

0 comments on commit 55931ab

Please sign in to comment.