Skip to content

Commit

Permalink
Publish dev task (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
gthea authored Aug 7, 2023
1 parent 71bef87 commit 49b49df
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 50 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Internal deploy

on:
push:
branches:
- development

jobs:
build-app:
name: Build App
runs-on: ubuntu-latest
env:
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }}
steps:
- name: checkout
uses: actions/checkout@v3

- name: Gradle cache
uses: gradle/[email protected]

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

- name: Publish
run: ./gradlew publishDev
136 changes: 86 additions & 50 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ apply plugin: 'signing'
apply plugin: 'kotlin-android'

ext {
splitVersion = '3.3.0'
splitVersion = '3.3.1-alpha-1'
}

android {
compileSdkVersion 31
compileSdk 33
targetCompatibility = '1.8'
sourceCompatibility = '1.8'

Expand All @@ -31,8 +31,8 @@ android {

defaultConfig {

minSdkVersion 15
targetSdkVersion 30
minSdk 15
targetSdk 31
multiDexEnabled true

consumerProguardFiles 'split-proguard-rules.pro'
Expand Down Expand Up @@ -159,6 +159,60 @@ dependencies {
androidTestImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVer"
}

def splitPOM = {
name = 'Split Android SDK'
packaging = 'aar'
description = 'Official Split Android SDK'
url = 'https://github.com/splitio/android-client'

licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}

developers {
developer {
id = 'sarrubia'
name = 'Sebastian Arrubia'
email = '[email protected]'
}

developer {
id = 'fernando'
name = 'Fernando Martin'
email = '[email protected]'
}
}

scm {
connection = 'scm:git:[email protected]:splitio/android-client.git'
developerConnection = 'scm:[email protected]:splitio/android-client.git'
url = 'https://github.com/splitio/android-client'
}
}

def releaseRepo = {
name = "ReleaseRepo"
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = ossrhUsername
password = ossrhPassword
}
}

def devRepo = {
name = "DevelopmentRepo"
url = 'https://splitio.jfrog.io/artifactory/maven-all-virtual'
credentials {
username = System.getenv('ARTIFACTORY_USER')
password = System.getenv('ARTIFACTORY_TOKEN')
}
}

afterEvaluate {
android.sourceSets.all { sourceSet ->
if (!sourceSet.name.startsWith("test")) {
Expand All @@ -168,7 +222,6 @@ afterEvaluate {

publishing {
publications {
project.components.all { print("PRJ NAME: " + name) }
release(MavenPublication) {
from components.release

Expand All @@ -177,60 +230,43 @@ afterEvaluate {
artifact sourcesJar
artifact javadocJar

pom {
name = 'Split Android SDK'
packaging = 'aar'
description = 'Official Split Android SDK'
url = 'https://github.com/splitio/android-client'

licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}

developers {
developer {
id = 'sarrubia'
name = 'Sebastian Arrubia'
email = '[email protected]'
}

developer {
id = 'fernando'
name = 'Fernando Martin'
email = '[email protected]'
}
}

scm {
connection = 'scm:git:[email protected]:splitio/android-client.git'
developerConnection = 'scm:[email protected]:splitio/android-client.git'
url = 'https://github.com/splitio/android-client'
}
}
pom splitPOM

repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
maven releaseRepo
maven devRepo
}
}

development(MavenPublication) {
from components.release

groupId = 'io.split.client'
version = splitVersion
artifact sourcesJar
artifact javadocJar

pom splitPOM
}
}
}
}

signing {
sign publishing.publications
task publishRelease(type: PublishToMavenRepository) {
publication = publishing.publications.getByName("release")
repository = publishing.repositories.ReleaseRepo
}

task publishDev(type: PublishToMavenRepository) {
publication = publishing.publications.getByName("development")
repository = publishing.repositories.DevelopmentRepo
}

signing {
sign publishing.publications.getByName("release")
}
}


task sourcesJar(type: Jar) {
archiveClassifier.set("sources")
from android.sourceSets.main.java.srcDirs
Expand Down

0 comments on commit 49b49df

Please sign in to comment.