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(workflows): add utils package build and release automation process #2838

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

zzcr
Copy link
Member

@zzcr zzcr commented Jan 22, 2025

PR

添加utils包构建发布自动化流程

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Workflow Updates

    • Enhanced GitHub Actions workflows to support building and publishing utility packages
    • Added new steps for building and publishing utility modules across multiple workflow configurations
  • Package Management

    • Added new script for publishing utility packages with public access
    • Expanded release process to include utility package processing
  • Release Process

    • Updated content replacement logic to handle utility package name transformations
    • Broadened release script to process utility package directories

Copy link

coderabbitai bot commented Jan 22, 2025

Walkthrough

This pull request introduces modifications to multiple GitHub Actions workflow files and the package configuration to incorporate utility package building and publishing. The changes primarily focus on adding new steps in .github/workflows/ files to build and publish utilities, updating the package.json with a new script for utility package publishing, and enhancing the release alpha script to process utility package names and directories.

Changes

File Change Summary
.github/workflows/auto-all-publish.yml Added "Run Build Utils" step and updated publish command to include pnpm pub:utils
.github/workflows/dispatch-all-publish-alpha.yml Added "Run Build Utils" step and modified publish command to include pnpm pub:utils
.github/workflows/dispatch-renderless-theme-publish-alpha.yml Updated input validation, added conditional build and publish steps for utils module
internals/cli/src/commands/release/releaseAlpha.ts Enhanced content replacement to include @opentiny/utils and added utils to processed directories
package.json Added new script pub:utils for publishing utils package

Possibly related PRs

Suggested labels

ci, enhancement

Suggested reviewers

  • kagol

Poem

🐰 Utilities dancing, workflows bright,
Publish and build with all our might!
Scripts and steps, a rabbit's delight,
Bringing code magic to new height!
Hop, hop, hooray for our CI flight! 🚀

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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. (Beta)
  • @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.

Copy link

概述

此PR添加了utils包的构建和发布自动化流程,更新了相关的CI工作流配置文件和发布脚本,以支持新的utils包的自动化发布。

变更

文件 概要
.github/workflows/auto-all-publish.yml, .github/workflows/dispatch-all-publish-alpha.yml 更新了工作流配置以支持utils包的发布。
.github/workflows/dispatch-renderless-theme-publish-alpha.yml 增加了对utils包的发布支持。
internals/cli/src/commands/release/releaseAlpha.ts 修改了发布脚本以包含utils包的路径和名称替换。
package.json 添加了utils包的发布命令。

@@ -36,7 +36,9 @@ const findAllpage = (packagesPath, updateVersion) => {
})
} else {
const content = fs.readFileSync(packagesPath).toString('UTF-8' as BufferEncoding)

Choose a reason for hiding this comment

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

Ensure that the replacement logic for package names is correct and does not unintentionally alter other parts of the file content.

Copy link

[e2e-test-warn]
The component to be tested is missing.

The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug".

Please make sure you've read our contributing guide

Copy link

@coderabbitai coderabbitai bot left a comment

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 (2)
.github/workflows/dispatch-all-publish-alpha.yml (1)

92-92: Consider splitting sequential publish commands.

The command pnpm pub:all && pnpm pub:utils && pnpm pub:site has multiple failure points. If any command fails, subsequent commands won't execute.

Consider splitting into separate steps for better error visibility:

      - name: Publish Vue3 And Vue2 components
        run: pnpm pub:all
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}

      - name: Publish Utils
        run: pnpm pub:utils
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}

      - name: Publish Site
        run: pnpm pub:site
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}
package.json (1)

85-85: Include utils package in the pub:all script.

The new pub:utils script follows the project's conventions and is properly configured. However, it should be included in the pub:all script to ensure the utils package is published during full releases.

Apply this diff to update the pub:all script:

-    "pub:all": "pnpm pub2 && pnpm pub3 && pnpm pub:theme && pnpm pub:themeMobile && pnpm pub:themeSaas && pnpm pub:renderless && pnpm pub:runtime",
+    "pub:all": "pnpm pub2 && pnpm pub3 && pnpm pub:theme && pnpm pub:themeMobile && pnpm pub:themeSaas && pnpm pub:renderless && pnpm pub:runtime && pnpm pub:utils",
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8f2ffe1 and 3f35aba.

📒 Files selected for processing (5)
  • .github/workflows/auto-all-publish.yml (1 hunks)
  • .github/workflows/dispatch-all-publish-alpha.yml (1 hunks)
  • .github/workflows/dispatch-renderless-theme-publish-alpha.yml (4 hunks)
  • internals/cli/src/commands/release/releaseAlpha.ts (2 hunks)
  • package.json (1 hunks)
🔇 Additional comments (9)
internals/cli/src/commands/release/releaseAlpha.ts (2)

39-41: LGTM! Package name replacement logic is consistent.

The addition of utils package name replacement follows the same pattern as the existing vue package replacement.


68-76: LGTM! Utils directory added to release process.

The utils directory has been appropriately added to the distLists array for processing during alpha releases.

.github/workflows/auto-all-publish.yml (2)

70-72: LGTM! Build utils step added in correct sequence.

The utils build step is appropriately positioned before the runtime build, following the established pattern of other build steps.


77-77: Verify error handling in sequential publish commands.

While the addition of pnpm pub:utils is correct, consider the failure scenario in the sequential execution. If pub:all fails, pub:utils won't execute.

Consider adding error handling or splitting into separate steps for better visibility and control of failures.

.github/workflows/dispatch-all-publish-alpha.yml (1)

82-84: LGTM! Build utils step matches auto-all-publish.yml.

The utils build step is consistently implemented across workflows.

.github/workflows/dispatch-renderless-theme-publish-alpha.yml (3)

28-31: LGTM! Improved module validation approach.

The array-based validation is more maintainable than individual checks.


84-87: LGTM! Conditional utils build step added.

The build step correctly uses the same condition pattern as other modules.


97-103: LGTM! Separate publish step for utils.

Good practice to have a separate publish step with its own condition, making the workflow more maintainable and errors more traceable.

package.json (1)

85-85: Verify utils package configuration.

Please ensure that the package.json in the utils directory is properly configured with the correct package name, version, and access settings.

Run the following script to verify the utils package configuration:

✅ Verification successful

Package configuration verified and properly set up

The utils package configuration is valid with proper package name, version, entry points, and TypeScript types defined. The public access is correctly enforced through the publish command.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify utils package configuration

# Check if package.json exists in utils directory
if [ -f "packages/utils/package.json" ]; then
  echo "Utils package.json found. Checking configuration..."
  
  # Extract and display relevant configuration
  cat packages/utils/package.json | jq '{
    name: .name,
    version: .version,
    private: .private,
    access: .publishConfig.access,
    main: .main,
    module: .module,
    types: .types
  }'
else
  echo "Error: packages/utils/package.json not found"
  exit 1
fi

Length of output: 533

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.

1 participant