Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/publish-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,29 @@ on:

env:
ANDROID_API_LEVEL: 33
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
CI: true

jobs:
test:
uses: ./.github/workflows/test.yaml
publish:
env:
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
JRELEASER_NEXUS2_SNAPSHOT_DEPLOY_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
JRELEASER_NEXUS2_SNAPSHOT_DEPLOY_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK 17
uses: actions/setup-java@v4
Expand All @@ -35,6 +46,6 @@ jobs:

- name: Publish Release artifact
run: ./gradlew eppo:assemble eppo:publish -Prelease --no-daemon
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Deploy to Maven Central
run: ./gradlew jreleaserDeploy
43 changes: 35 additions & 8 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@ name: Publish SDK Snapshot artifact

on:
push:
branches: [main]
branches: [main, tp/*]

env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}

CI: true

jobs:
publish-snapshot:
env:
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
JRELEASER_NEXUS2_SNAPSHOT_DEPLOY_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
JRELEASER_NEXUS2_SNAPSHOT_DEPLOY_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -25,8 +35,25 @@ jobs:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Publish Snapshot artifact
run: ./gradlew eppo:assemble eppo:publish -Psnapshot --no-daemon
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Test
run: ./gradlew eppo:check

- name: Stage artifacts
run: ./gradlew eppo:clean eppo:publish -Psnapshot

- name: Deploy to Maven Central
run: ./gradlew eppo:jreleaserPublish

- name: Upload build artifacts and logs
if: always()
uses: actions/upload-artifact@v4
with:
name: build-logs-and-artifacts-${{ github.run_number }}
path: |
build/reports/problems/**
eppo/build/reports/**
build/jreleaser/**
eppo/build/staging-deploy/**
**/build/libs/**
**/hs_err_pid*.log
retention-days: 7
124 changes: 88 additions & 36 deletions eppo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
plugins {
id 'com.android.library'
id 'maven-publish'
id "com.vanniktech.maven.publish" version "0.31.0"
id 'signing'
id 'org.jreleaser' version '1.18.0'
id "com.diffplug.spotless" version "7.0.3"
}

Expand Down Expand Up @@ -50,6 +49,13 @@ android {
excludes += "META-INF/**"
}
}

publishing {
singleVariant('release') {
withSourcesJar()
withJavadocJar()
}
}
}

ext {}
Expand All @@ -72,6 +78,9 @@ dependencies {

implementation 'org.slf4j:slf4j-api:2.0.17'

// Force newer Apache Commons Compress version for JReleaser 1.18.0 compatibility
implementation 'org.apache.commons:commons-compress:1.27.1'

implementation "androidx.core:core:${versions.androidx_core}"
implementation "com.squareup.okhttp3:okhttp:${versions.okhttp}"
implementation "com.github.zafarkhaja:java-semver:${versions.semver}"
Expand Down Expand Up @@ -104,54 +113,97 @@ spotless {
}
}

signing {
if (System.getenv("GPG_PRIVATE_KEY") && System.getenv("GPG_PASSPHRASE")) {
// Use in-memory keys for CI builds
useInMemoryPgpKeys(System.env.GPG_PRIVATE_KEY, System.env.GPG_PASSPHRASE)
}

sign publishing.publications // Sign all Maven publications
}

// Make sure signing tasks only run if configured correctly
tasks.withType(Sign) {
onlyIf {
(System.getenv("GPG_PRIVATE_KEY") && System.getenv("GPG_PASSPHRASE")) ||
(project.hasProperty('signing.keyId') &&
project.hasProperty('signing.password') &&
project.hasProperty('signing.secretKeyRingFile'))
}
}
publishing {
publications {
release(MavenPublication) {
groupId = 'cloud.eppo'
artifactId = 'android-sdk'
version = project.version

mavenPublishing {
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.S01)
signAllPublications()
coordinates("cloud.eppo", "android-sdk", project.version)
afterEvaluate {
from components.release
}

pom {
pom {
name = 'Eppo Android'
description = 'Eppo Android SDK'
url = 'https://github.com/Eppo-exp/android-sdk'
licenses {
license {
name = 'MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
}
license {
name = 'MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
}
}
developers {
developer {
name = 'Eppo'
email = 'https://www.geteppo.com'
}
developer {
name = 'Eppo'
email = 'https://www.geteppo.com'
}
}
scm {
connection = 'scm:git:git://github.com/Eppo-exp/android-sdk.git'
developerConnection = 'scm:git:ssh://github.com/Eppo-exp/android-sdk.git'
url = 'https://github.com/Eppo-exp/android-sdk/tree/main'
connection = 'scm:git:git://github.com/Eppo-exp/android-sdk.git'
developerConnection = 'scm:git:ssh://github.com/Eppo-exp/android-sdk.git'
url = 'https://github.com/Eppo-exp/android-sdk/tree/main'
}
}
}
}

repositories {
maven {
name = 'staging'
url = layout.buildDirectory.dir('staging-deploy')
}
}
}


jreleaser {
signing {
active = 'ALWAYS'
armored = true
verify = false
}
project {
name = 'android-sdk'
description = 'Android SDK for Eppo feature flag and experimentation platform'
longDescription = 'Android SDK for Eppo feature flag and experimentation platform'
links {
homepage = 'https://www.geteppo.com'
documentation = 'https://docs.geteppo.com'
license = 'https://github.com/Eppo-exp/android-sdk/blob/main/LICENSE'
bugTracker = 'https://github.com/Eppo-exp/android-sdk/issues'
}
authors = ['Eppo']
license = 'MIT'
inceptionYear = '2021'
}
deploy {
maven {
mavenCentral {
'release-deploy' {
active = 'RELEASE'
url = 'https://central.sonatype.com/api/v1/publisher'
stagingRepository('build/staging-deploy')
}
}
nexus2 {
'snapshot-deploy' {
active = 'SNAPSHOT'
snapshotUrl = 'https://central.sonatype.com/repository/maven-snapshots'
url = 'https://central.sonatype.com/repository/maven-snapshots'
applyMavenCentralRules = true
snapshotSupported = true
closeRepository = true
releaseRepository = true
stagingRepository('build/staging-deploy')
}
}
}
}
}


// Custom task to ensure we can conditionally publish either a release or snapshot artifact
// based on a command line switch. See github workflow files for more details on usage.
task checkVersion {
Expand Down
Loading