ge-semtk / semtk

Drag and drop SPARQL queries and data ingestion for virtuoso and soon other SPARQL endpoints
http://semtk.research.ge.com
Other
37 stars 6 forks source link

Publish SemTK SNAPSHOT jars as GitHub Packages #304

Closed tuxji closed 2 years ago

tuxji commented 2 years ago

The RACK plugin source depends on SemTK SNAPSHOT jars, so we need to publish them somewhere. GitHub has its own Maven repository service which is easy to use, so we will deploy the jars to GitHub Packages.

build.yaml: Improve comments and workflow name & triggers. Give workflow permission to publish packages. Add setup-java action to set up Java and Maven with settings file to deploy to GitHub Packages. Remove cache action since setup-java has its own cache. Add new step to publish SemTK SNAPSHOT jars to GitHub Packages.

release.yaml: Improve comments and workflow name. Add setup-java action to set up Java and Maven just like build.yaml. Remove cache action since setup-java has its own cache. Remove commented out obsolete steps.

fileStagingService/pom.xml: Remove duplicate declaration of same dependency.

pom.xml: Add new GitHub Packages repository and snapshotRepository to distributionManagement. Comment out Maven Central repository and snapshotRepository since distributionManagement allows only one instance of repository and snapshotRepository. If we deploy a future SemTK release to Maven Central Repository, we will have to remove SNAPSHOT from every pom anyway, so we can switch back the repository and snapshotRepository at that time too.

tuxji commented 2 years ago

I will fix the deploy step so that it runs only on a push to the master branch, not on a pull request. However, I am afraid that we need to lowercase SemTK's artifact ids before we can deploy them to GitHub Packages. CI got this error:

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project connectionUtils: Failed to deploy artifacts: Could not transfer artifact com.ge.research.semtk:connectionUtils:jar:2.5.0-20220722.163703-1 from/to github (https://maven.pkg.github.com/ge-semtk/semtk): transfer failed for https://maven.pkg.github.com/ge-semtk/semtk/com/ge/research/semtk/connectionUtils/2.5.0-SNAPSHOT/connectionUtils-2.5.0-20220722.163703-1.jar, status: 422 Unprocessable Entity -> [Help 1]

I've googled that error and people say that it goes away only if you lowercase the jar name, e.g., connectionutils or connection-utils instead of connectionUtils. Is that a change you're willing to make, Paul?

tuxji commented 2 years ago

Paul, now deploy works as expected, see packages here: https://github.com/orgs/ge-semtk/packages?repo_name=semtk and https://github.com/ge-semtk/semtk/packages/1554467. This pull request is ready for review and merge now - let me know if you would like me to squash and merge my comments into a single commit.

cuddihyge commented 2 years ago

I am not at all convinced that changing the names of every jar and deprecating mvn deploy to mvn central is a great approach. It may be the shortest path to convenience for the RACK eclipse plug-in at the expense of several other established projects. I may be stuck fielding requests for help from projects I didn't know/remember exist for some time. I could use some more convincing that we can't simple automatically invoke the deploy process that already existed ( but required manual build and mvn deploy, so it was not invoked often enough).

tuxji commented 2 years ago

After some testing, it's time to treat this PR as a failed experiment and close it. We can make GitHub Actions deploy lower-cased SemTK jars to GitHub Packages, but we would inflict too much pain on SemTK users asking them to lowercase semtk artifactIds in their poms and set up personal access tokens to authenticate their Maven builds to GitHub Packages. Instead, a Jenkins job will deploy semtk snapshots to OSSRH and SemTK users can make their poms or settings.xml download semtk snapshots directly from OSSRH's snapshots url. Just add the following section to your pom:

  <!-- Get our semtk dependencies directly from OSSRH snapshots -->
  <repositories>
    <repository>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
  </repositories>