Last active
November 15, 2019 09:30
-
-
Save prasad79/7eef45dfcb6333f5c530cd1324152c61 to your computer and use it in GitHub Desktop.
Fetching Android Library from Github Package Registry - Github Authentication code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def githubProperties = new Properties() githubProperties.load(new FileInputStream(rootProject.file(“github.properties”))) | |
repositories { | |
maven { | |
name = "GitHubPackages" | |
/* Configure path to the library hosted on GitHub Packages Registry | |
* Replace UserID with package owner userID and REPOSITORY with the repository name | |
* e.g. "https://maven.pkg.github.com/enefce/AndroidLibraryForGitHubPackagesDemo"*/ | |
url = uri("https://maven.pkg.github.com/UserID/REPOSITORY") | |
credentials { | |
/** Create github.properties in root project folder file with | |
** gpr.usr=GITHUB_USER_ID & gpr.key=PERSONAL_ACCESS_TOKEN | |
** Or set env variable GPR_USER & GPR_API_KEY if not adding a properties file**/ | |
username = githubProperties['gpr.usr'] ?: System.getenv("GPR_USER") | |
password = githubProperties['gpr.key'] ?: System.getenv("GPR_API_KEY") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment