Skip to content

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

@TomGranot

Description

@TomGranot

So now that #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: #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 :) )

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions