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

build: Fix Sonatype Central publishing #905

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

nightscape
Copy link
Owner

@nightscape nightscape commented Dec 4, 2024

PR Type

Enhancement


Description

  • Replaced the CiReleaseModule with SonatypeCentralPublishModule to align with Sonatype Central publishing requirements.
  • Introduced new dependencies: mill-contrib-sonatypecentral and mill.vcs.version for enhanced versioning and publishing capabilities.
  • Updated the publishVersion method to include VCS versioning with a -SNAPSHOT suffix for untagged versions.
  • Added a publishArtifacts method to filter out unnecessary artifacts from the publishing payload.
  • Configured extended read and await timeouts for Sonatype Central publishing.
  • Streamlined Spark version lists by removing outdated versions.

Changes walkthrough 📝

Relevant files
Enhancement
build.mill
Update build configuration for Sonatype Central publishing

build.mill

  • Replaced CiReleaseModule with SonatypeCentralPublishModule for
    publishing.
  • Added dependencies for mill-contrib-sonatypecentral and
    mill.vcs.version.
  • Updated publishVersion to use VcsVersion for versioning.
  • Introduced publishArtifacts method to filter out specific artifacts.
  • Adjusted Sonatype Central read and await timeout configurations.
  • Simplified Spark version lists by removing older versions.
  • +24/-9   

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    github-actions bot commented Dec 4, 2024

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Dependency Version
    Ensure that the version for mill-contrib-sonatypecentral is specified to avoid potential conflicts or unexpected behavior during runtime.

    Method Override
    The publishVersion method override changes the version format and might affect existing deployment or release workflows. Verify compatibility with current systems.

    Filtering Logic
    The filtering logic in publishArtifacts method to exclude certain artifacts might inadvertently exclude necessary files. Review the filter conditions to ensure essential artifacts are not omitted.

    Copy link

    github-actions bot commented Dec 4, 2024

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Specify the version for the mill-contrib-sonatypecentral dependency

    Ensure that the version string for mill-contrib-sonatypecentral is specified to
    avoid dependency resolution issues.

    build.mill [4]

    -import $ivy.`com.lihaoyi::mill-contrib-sonatypecentral:`
    +import $ivy.`com.lihaoyi::mill-contrib-sonatypecentral:0.4.0`  # Example version
    Suggestion importance[1-10]: 10

    Why: The suggestion correctly identifies a critical issue where the version of a dependency is not specified, which could lead to dependency resolution problems. Fixing this is crucial for the stability and predictability of the build process.

    10
    General
    Refine the artifact filtering logic in publishArtifacts

    Review the filtering condition in publishArtifacts to ensure it correctly identifies
    and excludes unwanted artifacts.

    build.mill [79]

    -publishData.payload.filterNot { case (ref, name) => ref.toString.contains("jar.dest") }
    +publishData.payload.filterNot { case (ref, name) => ref.toString.endsWith("jar.dest") }  # Assuming the intention is to match file names ending with 'jar.dest'
    Suggestion importance[1-10]: 6

    Why: Improving the filtering condition to correctly identify unwanted artifacts is important for ensuring that only the intended artifacts are published. This can prevent potential issues with artifact deployment.

    6
    Adjust the Sonatype Central timeout settings to more reasonable values

    Consider adjusting the timeout settings for sonatypeCentralReadTimeout and
    sonatypeCentralAwaitTimeout to more practical values if the current ones are too
    high.

    build.mill [83-84]

    -override def sonatypeCentralReadTimeout: T[Int] = 600000
    -override def sonatypeCentralAwaitTimeout: T[Int] = 1200 * 1000
    +override def sonatypeCentralReadTimeout: T[Int] = 300000  # Example: Reduce to 5 minutes
    +override def sonatypeCentralAwaitTimeout: T[Int] = 600 * 1000  # Example: Reduce to 10 minutes
    Suggestion importance[1-10]: 3

    Why: While adjusting timeout settings can be beneficial for optimizing wait times, the suggested values are arbitrary without specific context or justification. The impact is moderate, depending on the actual network conditions and server response times.

    3
    Check and adjust the untaggedSuffix in the version format to meet standard conventions

    Validate the untaggedSuffix value in VcsVersion.vcsState().format to ensure it
    aligns with versioning standards and requirements.

    build.mill [56]

    -val vcsVersion = VcsVersion.vcsState().format(untaggedSuffix = "-SNAPSHOT")
    +val vcsVersion = VcsVersion.vcsState().format(untaggedSuffix = "SNAPSHOT")  # Remove the leading hyphen if not required
    Suggestion importance[1-10]: 2

    Why: The suggestion to adjust the untaggedSuffix is minor and based on convention rather than a functional requirement. The impact is low as it primarily affects naming consistency rather than functionality.

    2

    @nightscape nightscape force-pushed the Publish-to-sonatype-central branch from f2e4a7b to d203a83 Compare December 4, 2024 22:25
    @nightscape nightscape merged commit 40722ee into main Dec 4, 2024
    26 checks passed
    @nightscape nightscape deleted the Publish-to-sonatype-central branch December 4, 2024 22:33
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant