diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..fa1639912 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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/gradle-build-action@v2.4.2 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 11 + cache: 'gradle' + + - name: Publish + run: ./gradlew publishDev diff --git a/build.gradle b/build.gradle index 8e1e9b273..aab058bc6 100644 --- a/build.gradle +++ b/build.gradle @@ -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' @@ -31,8 +31,8 @@ android { defaultConfig { - minSdkVersion 15 - targetSdkVersion 30 + minSdk 15 + targetSdk 31 multiDexEnabled true consumerProguardFiles 'split-proguard-rules.pro' @@ -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 = 'sebastian@split.io' + } + + developer { + id = 'fernando' + name = 'Fernando Martin' + email = 'fernando@split.io' + } + } + + scm { + connection = 'scm:git:git@github.com:splitio/android-client.git' + developerConnection = 'scm:git@github.com: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")) { @@ -168,7 +222,6 @@ afterEvaluate { publishing { publications { - project.components.all { print("PRJ NAME: " + name) } release(MavenPublication) { from components.release @@ -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 = 'sebastian@split.io' - } - - developer { - id = 'fernando' - name = 'Fernando Martin' - email = 'fernando@split.io' - } - } - - scm { - connection = 'scm:git:git@github.com:splitio/android-client.git' - developerConnection = 'scm:git@github.com: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