Class GithubPackagesRepositoryDsl

java.lang.Object
io.github.duckasteroid.gradle.githubpackages.GithubPackagesRepositoryDsl

public class GithubPackagesRepositoryDsl extends Object
DSL entrypoint for use inside a repositories block within build scripts.

 repositories {
     gitHubPackages {
         owner = "duckAsteroid"
         repo = "testing"
         // Optional: pick a named credential profile instead of the unqualified gpr.user/gpr.key
         // profile = "personal"
         // Optional: override credentials outright
         // username = "my-user"
         // token = "ghp_xxx"
     }
 }
 

Credential Resolution: If username/token are not explicitly provided, they are resolved using a three-tier fallback:

  1. Gradle properties: gpr.user / gpr.key, or gpr.<profile>.user / gpr.<profile>.key when profile is set
  2. Environment variables: GH_PACKAGES_READ_USER / GH_PACKAGES_READ_TOKEN
  3. Environment variables: GITHUB_ACTOR / GITHUB_TOKEN

Target repository handler: when invoked as gitHubPackages { ... } from within a repositories { } block, the repository is added to whichever RepositoryHandler actually delegates that block (e.g. project.repositories, publishing.repositories, or pluginManagement.repositories), resolved from the closure's lexical owner at call time. The handler passed to the constructor is only used as a fallback when that can't be determined (e.g. the Action-based entry point, which has no enclosing closure to inspect).

  • Constructor Details

    • GithubPackagesRepositoryDsl

      public GithubPackagesRepositoryDsl(org.gradle.api.artifacts.dsl.RepositoryHandler fallbackRepositories, org.gradle.api.provider.ProviderFactory providers)
  • Method Details