async-http-client icon indicating copy to clipboard operation
async-http-client copied to clipboard

Clean Up CI - Add GH Action to Publish to Maven Central

Open TomGranot opened this issue 4 years ago • 2 comments

So now that https://github.com/AsyncHttpClient/async-http-client/issues/1746 is done, time to think about what actually happens when a merge happens to master to the repo, this time in the world of GitHub Actions.

Rationale

In the current version of .travis.yml, a small script (before_script.sh) checks whether this is a PR build or a merge to master, and decides whether to run another script (make_credentials.py).

That script, in turn, inserts a few secrets (kept as environment variables on Travis, so we won't have to check them into source control) into the agent's .m2/settings.xml file. This is done as preparation for publishing to Maven Central (see here for a bit more context), which is then done in the after_success.sh script.

However, it seems thatbefore_script.sh, make_credentials.py and after_success.sh are all redundant when using GH Actions. The setup-java@1 appears to support this exact XML fun out of the box.

In Practice

What would replicating the full .travis.yml look like in GH actions, then?

Like this: https://github.com/AsyncHttpClient/async-http-client/pull/1758

Note that in the current Travis-based version, every time Travis builds master the deploy lifecycle phase is being run. That means that on every merge to master, a deployment to Maven is made - regardless of an actual release.

To be continued - If anyone has a bit of experience doing this type of migration, feel free to chime in. (@RahulKushwaha I'm looking at you :) )

TomGranot avatar Dec 19 '20 20:12 TomGranot

@TomGranot: I have not done this before, but lemme take a look at this. Did you already get this working?

RahulKushwaha avatar Dec 21 '20 03:12 RahulKushwaha

@RahulKushwaha Sort of, but coming to think about it - it's going to be hard for you to test without the username & password (or some sort of staging environment on the Maven Central side). I think it's better if you take a look at https://github.com/AsyncHttpClient/async-http-client/pull/1756 instead - mentioning you there.

TomGranot avatar Dec 21 '20 06:12 TomGranot

Successfully migrated to GitHub Actions.

hyperxpro avatar Jan 08 '23 16:01 hyperxpro