Skip to content

Conversation

@kagol
Copy link
Member

@kagol kagol commented Dec 5, 2024

PR

使用 GitHub Actions 自动化部署 TinyVue 网站,只要修改了 examples/sites 下的组件 demo,代码合入 dev 分支,就会自动构建和部署 TinyVue 网站,方便快速看到效果。

部署之后的地址:https://opentiny.github.io/tiny-vue

效果如下:

image

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

Release Notes

  • New Features

    • Introduced a new shell script for copying Markdown files from component directories.
    • Added a new environment configuration file with essential variables for application setup.
  • Improvements

    • Updated auto-deployment workflow with enhanced permissions and action versions for better performance.
    • Modified the build process to specify a mode and include the new shell script in the distribution.

These changes improve deployment efficiency and enhance the application's configuration capabilities.

@kagol kagol added the ci CI/CD (流水线持续集成) label Dec 5, 2024
@coderabbitai
Copy link

coderabbitai bot commented Dec 5, 2024

Walkthrough

The pull request introduces several changes to the auto-deployment workflow configuration, including updates to permissions and action versions. A new shell script is added to facilitate the copying of Markdown files between directories. Additionally, a new environment configuration file is created to define essential variables for the application. The package.json file is modified to enhance the build process by specifying a mode and including the new script.

Changes

File Change Summary
.github/workflows/auto-deploy-site.yml - Updated permissions to include contents: write for build job.
- Updated action versions for configure-pages, upload-pages-artifact, and deploy-pages.
- Added Repair build artifact step.
examples/sites/cp-component-md.sh - New script added to copy Markdown files from component directories to a specified location.
examples/sites/env/.env.pages - New environment configuration file added with several variables: VITE_CONTEXT, VITE_BUILD_TARGET, VITE_APP_MODE, VITE_APP_BUILD_BASE_URL, VITE_PLAYGROUND_URL.
examples/sites/package.json - Modified build script to include --mode pages and copy the new shell script to the distribution directory.

Possibly related PRs

  • ci: add auto deploy site #2582: The changes in this PR involve modifications to the .github/workflows/auto-deploy-site.yml file, which directly relate to the updates made in the main PR regarding the auto-deployment workflow configuration.

Suggested reviewers

  • zzcr

Poem

In the meadow, a rabbit hops,
With scripts and workflows, it never stops.
Markdown files, a new home to find,
With builds and deploys, all aligned.
Hooray for changes, let's cheer and play,
For a brighter, better coding day! 🐇✨


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 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.

@github-actions
Copy link

github-actions bot commented Dec 5, 2024

[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

@kagol kagol marked this pull request as draft December 5, 2024 09:43
@kagol kagol force-pushed the kagol/fix-auto-deploy-fail branch 6 times, most recently from 84194ff to f6bcf88 Compare December 5, 2024 12:51
@kagol kagol force-pushed the kagol/fix-auto-deploy-fail branch from f6bcf88 to 59427db Compare December 5, 2024 13:04
@kagol kagol force-pushed the kagol/fix-auto-deploy-fail branch from 59427db to b989412 Compare December 5, 2024 13:21
@kagol kagol force-pushed the kagol/fix-auto-deploy-fail branch from b989412 to 6e2f601 Compare December 5, 2024 13:54
@kagol kagol force-pushed the kagol/fix-auto-deploy-fail branch 2 times, most recently from 8fd6411 to e19da76 Compare December 6, 2024 04:12
@kagol kagol force-pushed the kagol/fix-auto-deploy-fail branch 3 times, most recently from cc41d97 to 7dae2ae Compare December 6, 2024 05:19
@kagol kagol force-pushed the kagol/fix-auto-deploy-fail branch from 7dae2ae to 4075ef7 Compare December 6, 2024 06:06
@kagol kagol marked this pull request as ready for review December 6, 2024 06:07
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: 1

🧹 Outside diff range and nitpick comments (2)
.github/workflows/auto-deploy-site.yml (2)

38-38: Consider investigating high memory usage

Setting --max-old-space-size=8192 indicates significant memory requirements during the build. Consider:

  1. Analyzing the build process for memory leaks or optimization opportunities
  2. Implementing incremental builds if possible

46-52: Document the repair steps in comments

The repair steps are crucial for deployment but lack documentation. Consider adding comments explaining:

  1. Why 777 permissions are necessary
  2. The purpose of copying commonjs helpers
  3. The reason for path modifications in design-common.js
      - name: Repair build artifact
        run: |
+         # Grant full permissions to ensure GitHub Pages can access files
          sudo chmod -R 777 ./_site
+         # Copy required commonjs helpers to assets
          cp ./examples/sites/dist/assets/_commonjsHelpers*.js ./_site/assets
+         # Create 404 page from index for SPA routing
          cp ./_site/index.html ./_site/404.html
+         # Update static asset paths for GitHub Pages deployment
          sed -i 's/\/static/\/tiny-vue\/static/' ./_site/static/js/design-common.js
+         # Copy component documentation
          sh ./examples/sites/dist/cp-component-md.sh
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 277de36 and 4075ef7.

📒 Files selected for processing (4)
  • .github/workflows/auto-deploy-site.yml (2 hunks)
  • examples/sites/cp-component-md.sh (1 hunks)
  • examples/sites/env/.env.pages (1 hunks)
  • examples/sites/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • examples/sites/cp-component-md.sh
  • examples/sites/env/.env.pages
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/auto-deploy-site.yml

[error] 66-66: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (4)
.github/workflows/auto-deploy-site.yml (4)

26-27: LGTM: Required permission for deployment

The addition of contents: write permission is necessary for the build job to modify repository contents during deployment.


40-40: LGTM: Action version updates

The updates to latest versions of GitHub Actions (configure-pages@v5, upload-pages-artifact@v3, deploy-pages@v4) follow security best practices.

Also applies to: 54-54, 63-63


64-66: LGTM: Standard GitHub Pages environment setup

The environment configuration is correctly set up for GitHub Pages deployment.

🧰 Tools
🪛 yamllint (1.35.1)

[error] 66-66: no new line character at the end of file

(new-line-at-end-of-file)


36-36: Verify the scope of dependency installation

The removal of the package filter -F @opentiny/vue-docs means all workspace dependencies will be installed. While this ensures all required dependencies are available, it might impact build time.

✅ Verification successful

Let me gather more information about the workspace and dependencies.


Based on the package.json analysis, I can now generate the final response:

Removing package filter is justified

The @opentiny/vue-docs package has multiple workspace dependencies including core packages, themes, icons, and design systems. Installing only the docs package without its workspace dependencies would lead to build failures. The removal of -F @opentiny/vue-docs filter is necessary to ensure all required dependencies are properly installed.

Key dependencies that justify this change:

  • Core dependencies: @opentiny/vue, @opentiny/vue-common
  • Design systems: vue-design-aurora, vue-design-saas, vue-design-smb
  • Themes: vue-theme, vue-theme-mobile, vue-theme-saas
  • Icons: vue-icon, vue-icon-multicolor, vue-icon-saas
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check the dependency tree to understand the scope
pnpm list -r --json | jq '.[] | select(.name=="@opentiny/vue-docs") | .dependencies'

Length of output: 91


Script:

#!/bin/bash
# Check workspace packages and their dependencies
fd package.json --type f --exclude node_modules --exclude .git | xargs cat | jq -r 'select(.name != null) | "\(.name):\n  dependencies: \(.dependencies // {})\n  devDependencies: \(.devDependencies // {})\n"'

Length of output: 11799

"build:saas:open": "vite build --mode saasopen",
"build:saas:prod": "vite build --mode saasprod",
"build": "vite build",
"build": "vite build --mode pages && cp cp-component-md.sh ./dist",
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Environment configuration and script are present but script needs executable permissions

The verification shows that both required files exist:

  • .env.pages is properly configured with necessary variables
  • cp-component-md.sh exists but lacks executable permissions (current: -rw-r--r--)

To ensure proper build execution, make the script executable with:

chmod +x examples/sites/cp-component-md.sh
🔗 Analysis chain

Verify pages mode configuration

The build script now includes --mode pages and copies the component documentation script. Please ensure:

  1. The .env.pages file exists with proper configuration
  2. The cp-component-md.sh script is properly versioned
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for environment configuration
if [ -f "examples/sites/env/.env.pages" ]; then
  echo "Found .env.pages configuration"
  cat "examples/sites/env/.env.pages"
else
  echo "Missing .env.pages configuration"
fi

# Verify script exists and is executable
if [ -f "examples/sites/cp-component-md.sh" ]; then
  echo "Found cp-component-md.sh script"
  ls -l "examples/sites/cp-component-md.sh"
else
  echo "Missing cp-component-md.sh script"
fi

Length of output: 584

@kagol kagol changed the title ci: fix auto deploy site failed ci: auto deploy site Dec 6, 2024
@zzcr zzcr merged commit 594bf40 into dev Dec 6, 2024
17 checks passed
@kagol kagol deleted the kagol/fix-auto-deploy-fail branch April 14, 2025 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD (流水线持续集成)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants