Add the following configuration to your build.sbt
:
// publish to github packages settings
publishTo := Some("GitHub <GITHUB_OWNER> Apache Maven Packages" at "https://maven.pkg.github.com/<GITHUB_OWNER>/<GITHUB_PROJECT>"),
publishMavenStyle := true,
credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
"<GITHUB_OWNER>",
System.getenv("GITHUB_TOKEN")
),
Set the GITHUB_TOKEN
environment variable to a valid github personal access token with write package permissions.
Create a workflow inside .github/workflows/publish.yml
name: Publish package to GitHub Packages
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Publish package
run: sbt test publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Set the GITHUB_TOKEN
environment variable to a valid github personal access token.
externalResolvers += "GitHub davideicardi Apache Maven Packages" at "https://maven.pkg.github.com/davideicardi/kaa"
libraryDependencies += "com.davideicardi" %% "kaa" % "<version>"
credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
"<GITHUB_OWNER>",
System.getenv("GITHUB_TOKEN")
)