Skip to content
Merged
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
32 changes: 31 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:

jobs:
publish:
publish-github:
if: |
github.event_name == 'workflow_dispatch' ||
(
Expand All @@ -29,6 +29,36 @@ jobs:
URL: ${{ vars.REES_REPO_URL }}
MAVEN_REPOSITORY_URL: ${{ vars.REES_MAVEN_URL }}
GRADLE_VERSION: 8.8
GRADLE_TASK: publishToGitHubPackages
secrets:
appSecret: ${{ secrets.PUBLISHER_SECRET }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY_FILE_AS_BASE64_STRING: ${{ secrets.SIGNING_KEY_FILE_AS_BASE64_STRING }}

publish-maven-central:
if: false # Temporarily disabled
# if: |
# github.event_name == 'workflow_dispatch' ||
# (
# github.event_name == 'pull_request' &&
# github.event.pull_request.merged == true &&
# startsWith(github.event.pull_request.head.ref, 'release/')
# )
uses: rees46/workflow/.github/workflows/reusable-android-publish.yaml@master
permissions: write-all
with:
appId: ${{ vars.PUBLISHER_ID }}
PROPERTIES_FILE: gradle.properties
SIGNING_SECRET_KEY_RING_FILE: com.rees46.key.gpg
SIGNING_SECRET_KEY_RING_FILE_LOCATION: ./personalization-sdk
OSSRH_USERNAME: ${{ vars.OSSRH_USERNAME }}
VARIANT_NAME: ${{ vars.REES_VARIANT_NAME }}
URL: ${{ vars.REES_REPO_URL }}
MAVEN_REPOSITORY_URL: ${{ vars.REES_MAVEN_URL }}
GRADLE_VERSION: 8.8
GRADLE_TASK: publishToMavenCentral
secrets:
appSecret: ${{ secrets.PUBLISHER_SECRET }}
SONATA_STAGING_PROFILE_ID: ${{ secrets.SONATA_STAGING_PROFILE_ID }}
Expand Down
2 changes: 2 additions & 0 deletions gradle/publishing/github.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
if (project.hasProperty('github')) {
publishing {
repositories {
maven {
Expand All @@ -13,3 +14,4 @@ publishing {
}
}
}
}
12 changes: 7 additions & 5 deletions gradle/publishing/maven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ publishing {
mavenLocal()
println "Publishing to local maven repository (mavenLocal) due to flag isPublishingInMavenLocal=true"
} else {
println "Publishing to local maven repository"
println "Publishing to Maven Central via OSSRH Staging API Service"
}

maven {
name = "sonatype"

def repositoryId = System.getenv("SONATYPE_REPOSITORY_ID") ?: error("Missing env variable: SONATYPE_REPOSITORY_ID")

def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deployByRepositoryId/${repositoryId}/"
// Updated URLs for OSSRH Staging API Service (compatibility layer)
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deployByRepositoryId/${repositoryId}/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl

println "Configured Sonatype repository with URL: ${url}"
Expand All @@ -35,8 +36,9 @@ nexusPublishing {
stagingProfileId = project.findProperty("stagingProfileId") ?: ""
username = sonataUsername
password = sonataPassword
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
// Updated URLs for OSSRH Staging API Service (compatibility layer)
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
21 changes: 21 additions & 0 deletions personalization-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,24 @@ tasks.register("printVariants") {
}
}
}

// Custom publishing tasks for independent repository publishing
tasks.register('publishToGitHubPackages') {
group = 'publishing'
description = 'Publish to GitHub Packages only'
dependsOn 'publish'
doFirst {
project.ext.set('github', true)
println "Publishing to GitHub Packages only"
}
}

tasks.register('publishToMavenCentral') {
group = 'publishing'
description = 'Publish to Maven Central only'
dependsOn 'publish'
doFirst {
project.ext.set('sonatype', true)
println "Publishing to Maven Central only"
}
}
Loading