Skip to content

Commit

Permalink
Publish Maven Package to GitHub Repo (#2)
Browse files Browse the repository at this point in the history
* Create release.ymlAdd WOrkflow to publish maven package

* Publish Maven Repo in build.sbt to GitHub package repo
  • Loading branch information
danielsmith-eu authored Jul 27, 2023
1 parent 8b690cb commit c1284a6
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
release:
types: [published]

name: Publish Maven Packages

permissions:
contents: write
packages: write

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: 'sbt'
- name: Run tests
working-directory: ./data-quality-profiler
run: sbt clean test publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Optional: This step uploads information to the GitHub dependency graph and unblocking Dependabot alerts for the repository
- name: Upload dependency graph
uses: scalacenter/sbt-dependency-submission@ab086b50c947c9774b70f39fc7f6e20ca2706c91
with:
working-directory: ./data-quality-profiler
24 changes: 23 additions & 1 deletion data-quality-profiler/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,32 @@ assembly / assemblyMergeStrategy := {
case _ => MergeStrategy.first
}

// these are all to allow local publishing to overwrite the version
/** make a fat jar */
artifact in (Compile, assembly) := {
val art = (artifact in (Compile, assembly)).value
art.withClassifier(Some("assembly"))
}
addArtifact(artifact in (Compile, assembly), assembly)
/***/


publishTo := Some(s"GitHub Apache Maven Packages" at s"https://maven.pkg.github.com/${System.getenv("GITHUB_REPOSITORY")}")
credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
System.getenv("GITHUB_REPOSITORY_OWNER"),
System.getenv("GITHUB_TOKEN")
)
publishMavenStyle := true
isSnapshot := true

// these are all to allow local publishing to overwrite the version
publishConfiguration := publishConfiguration.value.withOverwrite(true)
publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true)
isSnapshot := true

Test / publishArtifact := false


Compile / compile / wartremoverErrors ++= Seq(Wart.IterableOps, Wart.Throw, Wart.Null, Wart.Var, Wart.Return, Wart.OptionPartial, Wart.Any)
Compile / compile / wartremoverExcluded += (LocalRootProject / baseDirectory).value / "src" / "test"
Expand Down

0 comments on commit c1284a6

Please sign in to comment.