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

ci: snapshot publish workflow #5

Merged
merged 7 commits into from
Jul 12, 2024
Merged

Conversation

nsenave
Copy link
Contributor

@nsenave nsenave commented Feb 9, 2024

Add workflow that allow to publish snapshot version (in maven central snapshot repository) in pull requests, when the label publish-snapshot is applied.

@nsenave nsenave requested a review from FBibonne February 9, 2024 21:23
@nsenave nsenave self-assigned this Feb 9, 2024
@nsenave nsenave added publish-snapshot To be used in pull requests to trigger workflow and removed publish-snapshot To be used in pull requests to trigger workflow labels Feb 9, 2024
@nsenave nsenave added the publish-snapshot To be used in pull requests to trigger workflow label Feb 9, 2024
@github-actions github-actions bot removed the publish-snapshot To be used in pull requests to trigger workflow label Feb 9, 2024
@nsenave nsenave added the publish-snapshot To be used in pull requests to trigger workflow label Feb 9, 2024
@github-actions github-actions bot removed the publish-snapshot To be used in pull requests to trigger workflow label Feb 9, 2024
Copy link
Member

@FBibonne FBibonne left a comment

Choose a reason for hiding this comment

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

Ok for me. Maybe could we improve the pattern for snapshot versions in order to specify different metadata (RC, milestone, ...) ?


- name: Snapshot version verification
run: |
if ! [[ "${{ steps.version-step.outputs.version }}" =~ ^[0-9]+.[0-9]+.[0-9]+-SNAPSHOT$ ]]; then
Copy link
Member

@FBibonne FBibonne Feb 13, 2024

Choose a reason for hiding this comment

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

Semver pattern allows richer chains for previous release version or release metadata (https://semver.org/lang/fr/#spec-item-9 and item 10 also). Maybe patterns like ^[0-9]+.[0-9]+.[0-9]+-[0-9A-Za-z-]+$ should be better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I quite like enforcing "snapshot" since it has a meaning for maven (snapshots have a different overwrite mechanism), and adding other tags introduces some complexity that often feels not necessary

Yet it is restrictive in regards to semver... so we could use the more complex regex.

Isn't the "+" symbol missing for metadata?

Copy link
Member

Choose a reason for hiding this comment

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

I propose this pattern : (?>^[0-9]+.[0-9]+.[0-9]+-SNAPSHOT$)|(?>^[0-9]+.[0-9]+.[0-9]+-SNAPSHOT\+[0-9A-Za-z-]+$)

it means that the version must match ^[0-9]+.[0-9]+.[0-9]+-SNAPSHOT$ (for example 1.1.1-SNAPSHOT) or must match ^[0-9]+.[0-9]+.[0-9]+-SNAPSHOT\+[0-9A-Za-z-]+$ (for example 1.1.1-SNAPSHOT+feat1). So it is mandatory the version starts with x.y.z-SNAPSHOT and then it may be suffixed by a string wich starts with +

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great!

@nsenave
Copy link
Contributor Author

nsenave commented Feb 20, 2024

Maven publishing fails:

* What went wrong:
Execution failed for task ':model:publishMavenJavaPublicationToOSSRHRepository'.
> Failed to publish publication 'mavenJava' to repository 'OSSRH'
10 actionable tasks: 10 executed
   > Could not PUT 'https://oss.sonatype.org/content/repositories/snapshots/fr/insee/ddi/ddi-lifecycle/1.0.0-SNAPSHOT/maven-metadata.xml'. Received status code 401 from server: Unauthorized

I suspect that credentials might be incorrect (maybe extra quotes or something), yet I cannot access InseeFr credentials.

A link that may help: https://central.sonatype.org/faq/401-error/

@nsenave nsenave added the publish-snapshot To be used in pull requests to trigger workflow label Jul 12, 2024
@github-actions github-actions bot removed the publish-snapshot To be used in pull requests to trigger workflow label Jul 12, 2024
Copy link

👋 Version 1.0.0-SNAPSHOT published on maven central repository

@nsenave nsenave merged commit 297a270 into main Jul 12, 2024
@nsenave nsenave deleted the ci/snapshot-publish-workflow branch July 12, 2024 16:05
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.

2 participants