Skip to content

Conversation

@wzieba
Copy link
Collaborator

@wzieba wzieba commented Jun 30, 2025

Closes: AINFRA-522

As it supports Maven Central publication. OSSRH is reaching end of life on June 30, 2025.

I've decided to use Vanniktech's Gradle Maven Publish Plugin as it's one of the suggested in Gradle Cookbook and it's already used at A8c in Gravatar: Automattic/Gravatar-SDK-Android#590

How to test

You can check snapshots created by this PR
Logs: https://github.com/Parsely/parsely-android/actions/runs/15971368189/job/45043122854?pr=122
Artifacts: https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/com/parsely/parsely/4.1.1-SNAPSHOT/

If you wish, you can rerun build GitHub Action job and see a new snapshot artifact is present. This proves, that the Maven Central configuration should be correct (credentials + gpg keys). We'll be able to test if release actually works, with the next stable release.

wzieba added 2 commits June 30, 2025 12:57
As it supports Maven Central publication. OSSRH is reaching end of life on June 30, 2025.
@codecov
Copy link

codecov bot commented Jun 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.32%. Comparing base (d2c1896) to head (7c59b30).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #122   +/-   ##
=======================================
  Coverage   71.32%   71.32%           
=======================================
  Files          22       22           
  Lines         415      415           
  Branches       50       50           
=======================================
  Hits          296      296           
  Misses        105      105           
  Partials       14       14           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wzieba wzieba requested a review from Copilot June 30, 2025 11:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the project’s Maven publication setup to use Vanniktech’s Gradle Maven Publish Plugin, removes the custom publication.gradle script, and updates CI workflows to drive publication via the new plugin.

  • Adds and applies com.vanniktech.maven.publish in settings.gradle and the parsely module.
  • Deletes legacy Maven-Publish + Signing script (publication.gradle).
  • Updates GitHub Actions workflows to use publishToMavenCentral and new setup actions.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
settings.gradle Added Vanniktech Maven Publish plugin to pluginManagement block.
publication.gradle Removed entire custom maven-publish + signing configuration.
parsely/build.gradle Applied Vanniktech plugin, defined version logic, and configured publishing DSL.
.github/workflows/submit-gradle-dependencies.yml Replaced two-step Graph action with gradle/actions/dependency-submission@v4.
.github/workflows/readme.yml Switched to setup-gradle@v4, updated snapshot publish step and env props.
.github/workflows/publish.yml Switched to setup-gradle@v4, updated publish command and env props.

return 'git describe --abbrev=0 --tags'.execute().text.trim()
}

def isTagBuild = System.getenv("GITHUB_REF_TYPE") == 'tag'
Copy link

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GITHUB_REF_TYPE is not a standard CI environment variable in GitHub Actions, so isTagBuild will always be false. Consider passing a custom env var from your workflow (e.g. ref_type: ${{ github.ref_type }}) or parse GITHUB_REF to detect refs/tags/.

Suggested change
def isTagBuild = System.getenv("GITHUB_REF_TYPE") == 'tag'
def isTagBuild = System.getenv("GITHUB_REF")?.startsWith("refs/tags/")

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GITHUB_REF_TYPE is not a standard CI environment variable in GitHub Actions

It is though:

image

(source)

}

apply from: "${rootProject.projectDir}/publication.gradle"
def static getVersionFromGitTag() {
Copy link

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invoking shell commands via String.execute() lacks error handling and may not work on all platforms. Consider using Gradle's project.exec {} or a dedicated Git plugin (e.g., org.ajoberstar.grgit) for more robust tag retrieval.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, it's also not CC compatible, but this git operation is so straightforward and plain, that I don't think we need to use a service to run it. It worked without any issues so far.

@wzieba wzieba marked this pull request as ready for review June 30, 2025 11:29
@wzieba wzieba requested a review from ParaskP7 June 30, 2025 11:30
@ParaskP7
Copy link
Collaborator

ParaskP7 commented Jul 1, 2025

FYI: Unrelated, but if we have access to this repo @wzieba (I don't), let's auto-link AINFRA tickets via Settings, similar to what we do on other repos: 🙏

image

Copy link
Collaborator

@ParaskP7 ParaskP7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 @wzieba and thanks for dealing with the migration! 🚀 x 🥇 ^ 🙇

As it supports Maven Central publication. OSSRH is reaching end of life on June 30, 2025.

Can you think of any other such sdk/library we support that might be having the same need for such a migration. I can't think any... 🤞

I've decided to use Vanniktech's Gradle Maven Publish Plugin as it's one of the suggested in Gradle Cookbook and it's already used at A8c in Gravatar: Automattic/Gravatar-SDK-Android#590

💯

You can check snapshots created by this PR

I can't find the artifacts, getting a 404, can you help? 🙏 PS: I am logged-in. 👍

If you wish, you can rerun build GitHub Action job and see a new snapshot artifact is present. This proves, that the Maven Central configuration should be correct (credentials + gpg keys).

👍 + 🤞

We'll be able to test if release actually works, with the next stable release.

🤞

java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 PS: Which makes me wonder how come this wasn't there in the first place... 😊

SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
- name: Publish build artifacts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question (❓): Is that really not needed anymore, similar to us publishing build artifacts on functional-tests. PS: Which makes me wonder again, why was it needed before. 🤔

- name: Generate the dependency graph which will be submitted post-job
run: ./gradlew :parsely:dependencies
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise (❤️): Nice change, less configuration with dependency-submission, plus TIL! 🥇

return 'git describe --abbrev=0 --tags'.execute().text.trim()
}

def isTagBuild = System.getenv("GITHUB_REF_TYPE") == 'tag'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise (❤️): Nice addition of the tag/SNAPSHOT logic. 👍

@ParaskP7
Copy link
Collaborator

ParaskP7 commented Jul 1, 2025

Btw @wzieba, just for my FYI, did you follow any/all these 0.33.0 caution steps:

image

@ParaskP7
Copy link
Collaborator

ParaskP7 commented Jul 1, 2025

Also, unrelated, but just because I haven't worked on this library for so long, I tried running the UI tests (connectedDebugAndroidTest) again, for which I am now getting the following build failed, do you get the same on your side:

> Task :parsely:connectedDebugAndroidTest
Exception thrown during onBeforeAll invocation of plugin com.android.tools.utp.plugins.host.apkinstaller.AndroidTestApkInstallerPlugin.
Failed to install APK(s): /Users/petros.paraskevopoulos/.gradle/caches/modules-2/files-2.1/androidx.test/orchestrator/1.4.2/e39fb0a062aa533b8c2805bbf9648829a9cd977e/orchestrator-1.4.2.apk
INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package androidx.test.orchestrator signatures do not match newer version; ignoring!
com.android.ddmlib.InstallException: INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package androidx.test.orchestrator signatures do not match newer version; ignoring!
        at com.android.ddmlib.internal.DeviceImpl.installRemotePackage(DeviceImpl.java:1409)
        at com.android.ddmlib.internal.DeviceImpl.installPackage(DeviceImpl.java:1235)
        at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDevice.installPackage(DdmlibAndroidDevice.kt)
        at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDeviceController$executeAsync$deferred$1.invokeSuspend(DdmlibAndroidDeviceController.kt:192)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Wanted to share, just in case! 😊

@wzieba
Copy link
Collaborator Author

wzieba commented Jul 1, 2025

I can't find the artifacts, getting a 404

Me too, it seems there's an issue with Sonatype: if you snapshot repository and click on HTML index, 404 is already there.

did you follow any/all these 0.33.0 caution

yes

Also, unrelated, but just because I haven't worked on this library for so long, I tried running the UI tests

Just to be on the same page, it's not a UI test - this SDK doesn't provide UI. These tests are also executed on CI. From the stacktrace you shared, I see you have a conflict of orchestrator: either disable orchestrator and run tests or uninstall the orchestrator already installed on the test device 👍

@ParaskP7
Copy link
Collaborator

ParaskP7 commented Jul 1, 2025

Me too, it seems there's an issue with Sonatype: if you snapshot repository and click on HTML index, 404 is already there.

🤷

yes

Thanks for clarifying that for me! 🙏

Just to be on the same page, it's not a UI test - this SDK doesn't provide UI.

Ah, yea, I meant connected (functional) tests...

These tests are also executed on CI.

Yes. 👍

From the stacktrace you shared, I see you have a conflict of orchestrator: either disable orchestrator and run tests or uninstall the orchestrator already installed on the test device 👍

👍

@wzieba
Copy link
Collaborator Author

wzieba commented Jul 1, 2025

Thanks for the review @ParaskP7 ! I'll merge this as I see it's not the first time snapshot repository is broken. If anything, we'll adjust this configuration with the nearest release.

@wzieba wzieba merged commit 6c22480 into main Jul 1, 2025
3 checks passed
@ParaskP7
Copy link
Collaborator

ParaskP7 commented Jul 1, 2025

If anything, we'll adjust this configuration with the nearest release.

I agree, thanks @wzieba ! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants