Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/patilshreyas/androidgpr
Demonstration of deploying Android library to the GitHub Package Registry using GitHub Actions CI/CD
https://github.com/patilshreyas/androidgpr
android android-library devops github-actions github-package-registry hacktoberfest maven
Last synced: 24 days ago
JSON representation
Demonstration of deploying Android library to the GitHub Package Registry using GitHub Actions CI/CD
- Host: GitHub
- URL: https://github.com/patilshreyas/androidgpr
- Owner: PatilShreyas
- Created: 2020-10-02T06:07:37.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-10-02T07:28:31.000Z (about 4 years ago)
- Last Synced: 2024-05-01T16:17:05.505Z (6 months ago)
- Topics: android, android-library, devops, github-actions, github-package-registry, hacktoberfest, maven
- Language: Kotlin
- Homepage:
- Size: 146 KB
- Stars: 26
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Android Library - Release with _Github Package Registry_
- Demonstration of deploying Android library to the GitHub Package Registry using GitHub Actions CI/CD.
- In this example, whenever git tag is pushed to the GitHub branch then automatically library is published to the GitHub package registry and GitHub release is created (in draft mode).## Workflow
Refer [`release.yml`](/.github/workflows/release.yml) workflow which is GitHub Actions workflow for publishing package and creating draft release.
## Library configurationRefer [`build.gradle`](simplelibrary/build.gradle) of [**simplelibrary**](simplelibrary/) module.
```gradle
apply plugin: 'maven-publish' // 1. Apply plugin// 2. Declare library details
ext {
mGroupId = "com.example"
mArtifactId = "simple-library"
mVersionCode = 1
mVersionName = "0.2.0"mLibraryName = "SimpleLibrary"
mLibraryDescription = "Simple Library for simple things!"
}android {}
dependencies {}
// 3. Declare task for creation of android sources.
task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}// 4. Make configuration for publishing artifact.
afterEvaluate {
publishing {
publications {
maven(MavenPublication) {
groupId mGroupId
artifactId mArtifactId
version mVersionNamefrom components.release
artifact androidSourcesJar
pom {
name = mLibraryName
description = mLibraryDescription
}
}
}// 5. Update repository details and credentials.
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/PatilShreyas/AndroidGPR")
credentials {
username = System.getenv("GPR_USER")
password = System.getenv("GPR_KEY")
}
}
}
}
}// Assembling should be performed before publishing package
publish.dependsOn assemble
```## Implement library in app
Refer [`build.gradle`](app/build.gradle) of [**app**](app/) module.
```gradle
def localProperties = new Properties()
localProperties.load(new FileInputStream(rootProject.file("local.properties")))repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/PatilShreyas/AndroidGPR")
credentials {
username = 'PatilShreyas'
password = localProperties.getProperty("GPR_TOKEN")
}
}
}dependencies {
// Simple library
implementation 'com.example:simple-library:0.2.0'
}
```