async-http-client
async-http-client copied to clipboard
Clean Up CI - Add GH Action to Publish to Maven Central
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: I have not done this before, but lemme take a look at this. Did you already get this working?
@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.
Successfully migrated to GitHub Actions.