Currently, we have two workflows that are nearly identical except that one publishes to GitHub packages and the other publishes to Maven Central.
This PR consolidates them into one using GitHub's job conditionals. Specifically:
On pushes to main, the build workflow will now build and publish to GitHub packages.
On workflow triggers from a branch starting with "v", the build workflow will now build and publish to Maven Central.
In all other cases, the workflow will only build and not publish.
This PR also:
Uses the env-var $GITHUB_REPOSITORY to determine where to publish the package (rather than the hard-coded y-scope/clp-ffi-java which would fail when used in forks).
Refactors the build commands to simply build, test, and package in one step rather than unnecessarily building the native library first.
Doesn't rerun the tests before publishing to Maven Central.
Validation performed
In my fork, validated that the workflows succeed in all 3 cases listed above.
Description
Currently, we have two workflows that are nearly identical except that one publishes to GitHub packages and the other publishes to Maven Central.
This PR consolidates them into one using GitHub's job conditionals. Specifically:
This PR also:
y-scope/clp-ffi-java
which would fail when used in forks).Validation performed
In my fork, validated that the workflows succeed in all 3 cases listed above.