8000 build(semantic-release): add custom configuration by ljanner · Pull Request #28 · siemens/element · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

build(semantic-release): add custom configuration #28

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

Merged
merged 1 commit into from
May 23, 2025

Conversation

ljanner
Copy link
Member
@ljanner ljanner commented May 22, 2025

Purpose

This pull request introduces a custom semantic-release configuration based on the default preset, tailored to elements project's specific commit conventions and release logic.

Changes

  • Custom commit analysis logic in tools/semantic-release/config.js

    • Defines commitTypes used in CHANGELOG and the corresponding section titles.
    • Controls which types are included or hidden from the CHANGELOG.
    • The sorting of the CHANGELOG sections can be done by rearranging the arrays commitTypes and noteTitleMap
  • Automatic version bump logic - determine whether a release is major, minor, or patch based on the commits.

    • major is triggered by a commit that includes a note with BREAKING CHANGE (configurable through releaserc.js)
    • minor is triggered by a commit with the type feat (configurable through config.js)
    • patch is triggered by commits with the types fix, perf or revert (configurable through config.js)

Writer enhancements

Custom release note formatting in tools/semantic-release/writer-opts.js

  • Indent multi-line notes e.g. for BREAKING CHANGES
  • Create new sections NOTES and DEPRECATIONS in the CHANGELOG if commits with notes DEPRECATED: or NOTE: are found.
  • Ensure that notes like BREAKING CHANGE, DEPRECATED, and NOTE are included in the CHANGELOG, even when they originate from commits of hidden types (e.g., docs, refactor, chore, etc.).
  • Prevent hidden commit types (e.g. docs, refactor, chore, ...) from appearing in the CHANGELOG if they contain notes. Only the notes themselves should be shown in their appropriate sections (e.g., under BREAKING CHANGES), without revealing the hidden commit type or adding a section for it.
    • Example: With the default preset, a hidden commit like build(semantic-release): add custom configuration that includes a BREAKING CHANGE would generate a new section with an entry like:
      ### Build
      * **semantic-release:** add custom configuration
      With this setup, the Build section is suppressed, and only the BREAKING CHANGE note is shown, keeping the hidden type (build) excluded from the CHANGELOG output.

Testing

The configuration can be tested locally by using the following command that simulates a release without publishing artifacts or pushing tags:

npx semantic-release --dry-run --no-ci --loglevel debug

Because I have not setup any tokens on my environment I commented out the sections that include '@semantic-release/npm', and '@semantic-release/github' in the releaserc.js.

You can create commits using various types and note footers (e.g., fix: ..., feat: ..., with BREAKING CHANGE:,NOTE:, DEPRECATED:) and observe:

  • Which type of release would be triggered
  • How the CHANGELOG is structured
  • How notes appear in the generated CHANGELOG

@ljanner ljanner self-assigned this May 22, 2025
@ljanner ljanner force-pushed the build/semantic-release-custom-config branch from d0f7eed to a41f052 Compare May 22, 2025 12:19
@ljanner
Copy link
Member Author
ljanner commented May 22, 2025

Current problems:

  •  Multi-line notes
  • Scope of notes if type is hidden

@ljanner ljanner force-pushed the build/semantic-release-custom-config branch from a41f052 to 9f4cc66 Compare May 22, 2025 20:22
@ljanner ljanner removed request for kfenner and timowolf May 22, 2025 20:24
@ljanner
Copy link
Member Author
ljanner commented May 22, 2025

@spike-rabbit The pr is ready for review 🙏

Copy link
Member
@timowolf timowolf left a comment

Choose a reason for hiding this comment

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

Many thanks for the changes. Please describe in the commit what changes and why we change. For me it is not clear how the angular preset is different from the conventional change log and how it fits to our commit message rules. How can we test these rules and which rules we want. Let us clarify those topics.

@ljanner
Copy link
Member Author
ljanner commented May 23, 2025

Many thanks for the changes. Please describe in the commit what changes and why we change. For me it is not clear how the angular preset is different from the conventional change log and how it fits to our commit message rules. How can we test these rules and which rules we want. Let us clarify those topics.

I've updated the pull request description with a detailed explanation of the changes, how they relate to element's commit message rules, and how they can be tested locally. If anything remains unclear, feel free to reach out 🙌

/cc @timowolf @spike-rabbit

Copy link
Member
@timowolf timowolf left a comment

Choose a reason for hiding this comment

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

LGTM

@timowolf timowolf merged commit 73861b9 into main May 23, 2025
5 checks passed
@siemens-element-bot
Copy link
Collaborator

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

Successfully merging this pull request may close these issues.

4 participants
0