-
Notifications
You must be signed in to change notification settings - Fork 35
Publish to github packages
Hannes Achleitner edited this page Apr 19, 2026
·
1 revision
- 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)
- Run the publish task
./gradlew :chartLib:publishAllPublicationsToGitHubPackagesRepository
./gradlew :chartLibCompose:publishAllPublicationsToGitHubPackagesRepository
Or both at once:
./gradlew :chartLib:publishAllPublicationsToGitHubPackagesRepository \
:chartLibCompose:publishAllPublicationsToGitHubPackagesRepository
- 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
- 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.