Skip to content

Publish to github packages

Hannes Achleitner edited this page Apr 19, 2026 · 1 revision
  1. Set the environment variables GitHub Packages requires authentication. Set these in your shell or CI:
export GITHUBACTOR="your-github-username"`
export GITHUBTOKEN="your-github-personal-access-token"

The token needs the write:packages scope. Create one at: GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)

  1. Run the publish task
./gradlew :chartLib:publishAllPublicationsToGitHubPackagesRepository
./gradlew :chartLibCompose:publishAllPublicationsToGitHubPackagesRepository

Or both at once:

./gradlew :chartLib:publishAllPublicationsToGitHubPackagesRepository \
   :chartLibCompose:publishAllPublicationsToGitHubPackagesRepository
  1. For CI (GitHub Actions) In your workflow, the token is already available as GITHUB_TOKEN:
- name: Publish to GitHub Packages
  env:
    GITHUBACTOR: ${{ github.actor }}
    GITHUBTOKEN: ${{ secrets.GITHUB_TOKEN }}
  run: |
    ./gradlew :chartLib:publishAllPublicationsToGitHubPackagesRepository \
              :chartLibCompose:publishAllPublicationsToGitHubPackagesRepository
  1. Consumer setup Users of your library need to add GitHub Packages as a repository and authenticate too: // settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        maven {
            url = uri("https://maven.pkg.github.com/AppDevNext/AndroidChart")
            credentials {
                username = providers.gradleProperty("githubUser").orNull
                password = providers.gradleProperty("githubToken").orNull
            }
        }
    }
}

Then depend on:

implementation("com.github.AppDevNext.AndroidChart:chartLib:VERSION-SNAPSHOT")
implementation("com.github.AppDevNext.AndroidChart:chartLibCompose:VERSION-SNAPSHOT")

Note: GitHub Packages always requires authentication, even for public repos — unlike JitPack. If you want zero-auth consumption, JitPack remains the easier option for public libraries.

Clone this wiki locally