Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 1588 publish to maven central #1596

Merged
merged 63 commits into from
Oct 20, 2023
Merged

Conversation

jcpitre
Copy link
Contributor

@jcpitre jcpitre commented Oct 19, 2023

Summary:
closes #1588
Modified the build.gradle of the modules to upload (main, core and model) to add signing and publishing.
Added a Github action to publish the released artifact.

Expected behavior:
To publish, you need to have a git tag directly in the commit, with semantic versioning format.
The GH action can be triggered by hand or for a prerelease or release.

If successful, there will be a new staging repo in https://s01.oss.sonatype.org/index.html#stagingRepositories containing the artefacts (e.g. https://s01.oss.sonatype.org/content/repositories/orgmobilitydata-1029/. This repo will likely be deleted by the time you read this, but it should be similar)
The artefacts should be signed (look for .sha1, .sha256 etc)

To test the deployment, you have to manually close the repo on sonatype. This will trigger acceptance tests for maven (artefacts are signed, etc).
If successful the staging repo will be available to use for testing. You will need to add a repository with the URL mentioned above (or similar) to your pom.xml or build.gradle.

Once the testing is done, the repo can be manually promoted to maven central.

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with gradle test to make sure you didn't break anything
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

@github-actions
Copy link
Contributor

This contribution does not follow the conventions set by the Google Java style guide. Please run the following command line at the root of the project to fix formatting errors: ./gradlew goJF.

@github-actions
Copy link
Contributor

✅ Rule acceptance tests passed.
New Errors: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1476 sources (~0 %) are corrupted.
Commit: 3d05261
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

… main. The java format verifier does not like it.
@github-actions
Copy link
Contributor

This contribution does not follow the conventions set by the Google Java style guide. Please run the following command line at the root of the project to fix formatting errors: ./gradlew goJF.

Comment on lines 12 to 15
on:
release:
types: [ prereleased, released ]
workflow_dispatch:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be more generic to trigger the action by listening to tag pushes so that any new tag will be published.
Example:

on:
  push:
    tags:
      - '*'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. But it should be restricted to tags that have the proper syntax (e.g. v4.2.1), If not the axion-release plugin will not work. I initially was using an uppercase V at the beginning of the version, and it did not work! It came with some headaches.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not put tag as a trigger in the end since the other part of publish_assets.yml needs a release trigger.

# At this point it should manually be closed, which will trigger acceptance tests for maven central (but not transfer yet)
# Once closed, thew repo is available for testing.
# After testing, it can be manually promoted on the sonatype site, which will then publish to maven central.
name: Upload Release Jars to Sonatype
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think if we add the jobs implemented here to

name: Upload Release Assets
to avoid sync issues between what we have in the Github repository and what is published in maven

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you want to combine the two actions?
Or have one trigger the other

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combining the two actions seems to be a reasonable solution.

Copy link
Contributor Author

@jcpitre jcpitre Oct 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combining is possible, but having a tag push as a trigger instead of a release event will not work since the action uploads to a release and needs the release event to obtain the release url.
To keep them combined we could trigger on both the release event and the tag push event, but select the steps that are run on each event, ie dont tun the upload to release if it's not a release event.
Or we could separate them and each have their own trigger.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point. My bad, I was looking at the default example from upload-release-asset action and the implementation is the other way around. They create a release as part of the tag push: https://github.com/actions/upload-release-asset#example-workflow---upload-a-release-asset.
To conclude, let's leave the pre-release and release triggers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still kept them combined but added a workflow_dispatched trigger that is used only by the sonatype upload.

@github-actions
Copy link
Contributor

✅ Rule acceptance tests passed.
New Errors: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1476 sources (~0 %) are corrupted.
Commit: 725bb72
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

… push a tag instead of release or prerelease.
@github-actions
Copy link
Contributor

This contribution does not follow the conventions set by the Google Java style guide. Please run the following command line at the root of the project to fix formatting errors: ./gradlew goJF.

@github-actions
Copy link
Contributor

✅ Rule acceptance tests passed.
New Errors: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1476 sources (~0 %) are corrupted.
Commit: 9a05aed
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

…spatch (manual) but limited it to the Sonatype upload.
@github-actions
Copy link
Contributor

This contribution does not follow the conventions set by the Google Java style guide. Please run the following command line at the root of the project to fix formatting errors: ./gradlew goJF.

@github-actions
Copy link
Contributor

This contribution does not follow the conventions set by the Google Java style guide. Please run the following command line at the root of the project to fix formatting errors: ./gradlew goJF.

@github-actions
Copy link
Contributor

This contribution does not follow the conventions set by the Google Java style guide. Please run the following command line at the root of the project to fix formatting errors: ./gradlew goJF.

@github-actions
Copy link
Contributor

✅ Rule acceptance tests passed.
New Errors: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1476 sources (~0 %) are corrupted.
Commit: f318a05
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

@davidgamez
Copy link
Member

This looks good to me. As a last ask, can you update the release documentation, adding the steps to publish to maven? Thanks!

@github-actions
Copy link
Contributor

✅ Rule acceptance tests passed.
New Errors: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1476 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1476 sources (~0 %) are corrupted.
Commit: 06700cb
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

@jcpitre jcpitre merged commit fdd6c9b into master Oct 20, 2023
333 checks passed
@jcpitre jcpitre deleted the 1588-publish-to-maven-central branch October 20, 2023 17:15
@jcpitre
Copy link
Contributor Author

jcpitre commented Oct 25, 2023

You can now use Maven Central as repository for released versions of GTFS-validator artifacts.
For the dependency in pom.xml or build.gradle, the groupId is now
org.mobilitydata.gtfs-validator
(the version built with Jitpack had groupId com.github.MobilityData.gtfs-validator)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jitpack as artifact hosting is unreliable, consider using Maven Central or GitHub Packages instead
3 participants