Skip to content

[ci] Make patch releases from release-X.Y branches - #816

Merged
Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
fix-ci-minor
Apr 17, 2025
Merged

Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
fix-ci-minor

Conversation

@kvaps

@kvaps Andrei Kvapil (kvaps) commented Apr 16, 2025 •

Copy link
Copy Markdown
Member

This PR includes the following changes:

  • Do not remove version tag as part of releasing pipeline
  • Overwrite tag only by fact of merging releasing pull request
  • Automatically detect merge base and prepare pull request for this base
  • Allow to run pipeline only for tags created on main and release-X.Y branches

Signed-off-by: Andrei Kvapil [email protected]

Summary by CodeRabbit

  • Chores
    • Improved workflow reliability by forcing Git tag creation and push to overwrite existing tags if necessary.
    • Enhanced workflow documentation with detailed, numbered comments for greater clarity.
    • Updated tag-based workflow to dynamically determine the base branch, ensuring only valid branches are used.
    • Removed the automatic deletion of pushed tags in the workflow.

@coderabbitai

coderabbitai Bot commented Apr 16, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This update modifies two GitHub Actions workflow files related to release and tag handling. The release workflow now uses forced tag creation and pushing to ensure tags are overwritten if they already exist. The tag workflow introduces dynamic detection of the base branch for tags, enforces stricter branch criteria, and reorganizes steps with clearer annotations. It also removes the tag deletion step and updates the pull request creation to use the dynamically determined base branch. The workflows are now more robust in handling tags and releases, with improved control flow and documentation.

Changes

File(s) Change Summary
.github/workflows/pull-requests-release.yaml Added --force to git tag and git push commands to allow forced overwriting of tags during release workflow execution.
.github/workflows/tags.yaml Added base branch detection, stricter branch validation, reordered and annotated steps, removed tag deletion, improved control flow.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant Repository
    participant Maintainer

    GitHub Actions->>Repository: Detect tag push
    GitHub Actions->>GitHub Actions: Determine base branch (must be 'main' or 'release-X.Y')
    alt Valid base branch
        GitHub Actions->>GitHub Actions: Proceed with workflow steps
        GitHub Actions->>Repository: Build artifacts, create/reuse draft release, upload assets, run tests
        GitHub Actions->>Repository: Create PR with base branch
    else Invalid base branch
        GitHub Actions->>GitHub Actions: Fail workflow early
    end
Loading

Possibly related PRs

Suggested reviewers

  • lllamnyp

Poem

In the warren where workflows hop and leap,
Tags now force their way, no secrets to keep.
Branches checked with a careful glance,
Only 'main' or 'release' get a chance.
With steps now numbered, neat and bright,
The CI bunnies sleep well tonight.
🐇✨

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/tags.yaml (1)

50-50: Remove trailing whitespace for YAML lint compliance.

There is a trailing space at line 50, which can cause YAML linters to fail. Please remove it to maintain formatting standards.

-              For a push event with a tag, GitHub sets context.payload.base_ref 
+              For a push event with a tag, GitHub sets context.payload.base_ref
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 50-50: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 86210c1 and bd5e70b.

📒 Files selected for processing (2)
  • .github/workflows/pull-requests-release.yaml (1 hunks)
  • .github/workflows/tags.yaml (6 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/tags.yaml

[error] 50-50: trailing spaces

(trailing-spaces)

🔇 Additional comments (3)
.github/workflows/tags.yaml (2)

42-68: Dynamic base branch detection and validation is robust and well-implemented.

The logic for determining and validating the base branch from which the tag was pushed is clear, strict, and prevents accidental releases from the wrong branches. This is a best practice for release workflows.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 50-50: trailing spaces

(trailing-spaces)


111-151: Dynamic pull request creation targets correct base branch.

The update to use the dynamically determined base branch for PR creation ensures that release PRs are always targeted appropriately, reducing manual errors and improving automation reliability.

.github/workflows/pull-requests-release.yaml (1)

71-72: Use of --force for tag creation and push aligns with robust tag management.

Adding --force to both git tag and git push ensures that tags can be safely overwritten as required by the updated release process. This is consistent with the stricter tag handling in the tags workflow.

Comment thread .github/workflows/tags.yaml
Comment thread .github/workflows/tags.yaml
Comment thread .github/workflows/tags.yaml Outdated
Comment thread .github/workflows/tags.yaml Outdated
Comment thread .github/workflows/tags.yaml
Signed-off-by: Andrei Kvapil <[email protected]>
Co-authored-by: Nick Volynkin <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/tags.yaml (1)

49-50: Remove trailing whitespace for YAML lint compliance.

There is a trailing space at line 50, flagged by static analysis. While this does not affect workflow execution, it's best practice to remove it for YAML lint compliance.

-            /*
-              For a push event with a tag, GitHub sets context.payload.base_ref 
+            /*
+              For a push event with a tag, GitHub sets context.payload.base_ref
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 50-50: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd5e70b and 7dbb8a1.

📒 Files selected for processing (2)
  • .github/workflows/pull-requests-release.yaml (1 hunks)
  • .github/workflows/tags.yaml (6 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/pull-requests-release.yaml
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/tags.yaml

[error] 50-50: trailing spaces

(trailing-spaces)

🔇 Additional comments (4)
.github/workflows/tags.yaml (4)

42-68: Dynamic base branch detection and validation is robust and clear.

The logic for determining and validating the base branch from which the tag was pushed is well-implemented. The workflow now fails early with clear error messages if the tag is not from main or a release-X.Y branch, preventing accidental or unauthorized releases.

This is a significant improvement in release safety and clarity.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 50-50: trailing spaces

(trailing-spaces)


111-151: Dynamic PR creation using detected base branch is correct and maintainable.

The pull request creation step now uses the dynamically detected base branch, ensuring that release PRs always target the correct branch. This prevents mistakes and reduces manual intervention.

The logic for checking existing PRs and labeling new ones is also clear and robust.


19-41: Release existence check and early skip logic is sound.

The workflow checks for an existing non-draft release with the same tag and skips the rest of the steps if found. This prevents duplicate releases and unnecessary work.

The logic is clear and the output is easy to follow.


69-195: Step annotations and conditional execution improve maintainability.

The workflow steps are now clearly annotated and conditionally executed based on whether a release already exists. This improves readability and maintainability for future contributors.

No issues found in the build, commit, branch, release, asset, or test steps.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LTGM!

@kvaps
Andrei Kvapil (kvaps) merged commit 8570449 into main Apr 17, 2025
@kvaps
Andrei Kvapil (kvaps) deleted the fix-ci-minor branch April 17, 2025 07:14
Andrei Kvapil (kvaps) added a commit that referenced this pull request Apr 17, 2025
This PR includes the following changes:

* Do not remove version tag as part of releasing pipeline
* Overwrite tag only by fact of merging releasing pull request
* Automatically detect merge base and prepare pull request for this base
* Allow to run pipeline only for tags created on `main` and
`release-X.Y` branches


Signed-off-by: Andrei Kvapil <[email protected]>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
- Improved workflow reliability by forcing Git tag creation and push to
overwrite existing tags if necessary.
- Enhanced workflow documentation with detailed, numbered comments for
greater clarity.
- Updated tag-based workflow to dynamically determine the base branch,
ensuring only valid branches are used.
	- Removed the automatic deletion of pushed tags in the workflow.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@NickVolynkin Nick Volynkin (NickVolynkin) changed the title [ci] Update pipeline for patch releases [ci] Make patch releases from release-X.Y branches Apr 18, 2025
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.

3 participants