Skip to content

Commit

Permalink
VIT-7196: Move to GitHub Package Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
andersio committed Aug 15, 2024
1 parent 62e274a commit ffa7eb2
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 6 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Android Release

on:
release:
types: [released, prereleased]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Publish
run: ./gradlew publish
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ github.token }}
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 25 additions & 1 deletion VitalClient/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ android {
minSdk 24
targetSdk 34

aarMetadata {
minCompileSdk = 34
}

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
Expand All @@ -28,6 +32,12 @@ android {
}
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}

compileOptions {
coreLibraryDesugaringEnabled true

Expand Down Expand Up @@ -74,4 +84,18 @@ dependencies {
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinx_coroutines_test"

coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugar_jdk_libs"
}
}

publishing {
publications {
release(MavenPublication) {
groupId = 'io.tryvital'
artifactId = 'vital-client'
version = '3.2.0-beta.1'

afterEvaluate {
from components.release
}
}
}
}
26 changes: 25 additions & 1 deletion VitalDevices/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ android {
minSdk 26
targetSdk 34

aarMetadata {
minCompileSdk = 34
}

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
Expand All @@ -22,6 +26,12 @@ android {
}
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -49,4 +59,18 @@ dependencies {
testImplementation "junit:junit:$junit"
androidTestImplementation "androidx.test.ext:junit:$test_ext"
androidTestImplementation "androidx.test.espresso:espresso-core:$test_espresso"
}
}

publishing {
publications {
release(MavenPublication) {
groupId = 'io.tryvital'
artifactId = 'vital-devices'
version = '3.2.0-beta.1'

afterEvaluate {
from components.release
}
}
}
}
26 changes: 25 additions & 1 deletion VitalHealthConnect/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ android {
minSdk 26
targetSdk 34

aarMetadata {
minCompileSdk = 34
}

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
Expand All @@ -23,6 +27,12 @@ android {
}
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -73,4 +83,18 @@ dependencies {
testImplementation "org.mockito:mockito-inline:$mockito_inline"
testImplementation "com.squareup.okhttp3:mockwebserver:$mockwebserver"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinx_coroutines_test"
}
}

publishing {
publications {
release(MavenPublication) {
groupId = 'io.tryvital'
artifactId = 'vital-health-connect'
version = '3.2.0-beta.1'

afterEvaluate {
from components.release
}
}
}
}
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,6 @@ dependencies {
debugImplementation "androidx.compose.ui:ui-tooling:$compose"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose"
}

tasks.withType(PublishToMavenRepository).configureEach { enabled = false }
tasks.withType(PublishToMavenLocal).configureEach { enabled = false }
19 changes: 19 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,25 @@ plugins {
id 'org.jetbrains.kotlin.android' version '1.8.22' apply false
}

def localProperties = new Properties()
localProperties.load(project.rootProject.file("local.properties").newDataInputStream())

subprojects {
apply plugin: "maven-publish"
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/tryVital/vital-android")
credentials {
username = localProperties.getProperty("gpr.user") ?: System.getenv("USERNAME")
password = localProperties.getProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencyResolutionManagement {
mavenCentral()
}
}
rootProject.name = "Vital sample"
rootProject.name = "vital-android"
include ':app'
include ':VitalClient'
include ':VitalDevices'
Expand Down

0 comments on commit ffa7eb2

Please sign in to comment.