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: add auto deploy site #2582

Merged
merged 1 commit into from
Nov 30, 2024
Merged

ci: add auto deploy site #2582

merged 1 commit into from
Nov 30, 2024

Conversation

kagol
Copy link
Member

@kagol kagol commented Nov 30, 2024

PR

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

  • New Features

    • Introduced an automated deployment workflow for the site, triggered on updates to the dev branch.
    • Added manual deployment option through a trigger.
    • Ensured only one deployment occurs at a time, canceling any in-progress deployments.
  • Improvements

    • Enhanced deployment process with defined build and deploy jobs for streamlined site updates.

@kagol kagol added the ci CI/CD label Nov 30, 2024
Copy link

coderabbitai bot commented Nov 30, 2024

Walkthrough

This pull request introduces a new GitHub Actions workflow file, auto-deploy-site.yml, designed to automate the deployment of a site. The workflow is triggered by pushes to the dev branch and includes manual triggering options. It defines two jobs, build and deploy, with specific permissions and concurrency settings to manage deployment processes effectively. The build job handles site preparation, while the deploy job uploads the built site to GitHub Pages.

Changes

File Path Change Summary
.github/workflows/auto-deploy-site.yml - New workflow added: name: Auto Deploy Site
- Trigger event: on: push for branch dev
- Permissions declared: permissions: contents: read, pages: write, id-token: write
- Concurrency setting: concurrency: group: pages, cancel-in-progress: true
- New job added: build
- New job added: deploy

Possibly related PRs

  • ci(build): fix theme concat error #2145: The changes in this PR involve modifications to the build process, which is directly relevant to the new build job introduced in the main PR's GitHub Actions workflow for site deployment.

Poem

🐇 In the meadow where the code does play,
A workflow blooms to brighten the day.
With builds and deploys, oh what a sight,
Our site will shine, all day and night!
Hops of joy as we push to the dev,
A rabbit's cheer for the code we weave! 🌼


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.

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: 3

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

3-20: Consider adding environment protection rules

The workflow configuration is well-structured with appropriate triggers and permissions. However, to enhance security, consider setting up environment protection rules for the github-pages environment to restrict deployments to specific branches or require approvals.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2f16669 and 6b61216.

📒 Files selected for processing (1)
  • .github/workflows/auto-deploy-site.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/auto-deploy-site.yml

28-28: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


38-38: the runner of "actions/configure-pages@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


57-57: the runner of "actions/deploy-pages@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 yamllint (1.35.1)
.github/workflows/auto-deploy-site.yml

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

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

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

1-57: Verify no conflicting workflows exist

Let's ensure there are no other workflows that might conflict with this new auto-deploy functionality.

✅ Verification successful

No conflicting workflows found

The verification shows that auto-deploy-site.yml is the only workflow file handling GitHub Pages deployments and site-related tasks. No other workflows are targeting the same paths or using similar deployment actions, which confirms there won't be any conflicts with this new workflow.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other workflow files that might handle site deployment
fd -e yml -e yaml . .github/workflows/ --exec grep -l "github-pages\|deploy.*site\|site.*deploy"

Length of output: 137


Script:

#!/bin/bash
# Let's do a more thorough check for any deployment-related workflows
# 1. Check for any workflow files with 'deploy' or 'pages' in their content
fd -e yml -e yaml . .github/workflows/ --exec grep -l "deploy\|pages"

# 2. Look for specific GitHub Pages and deployment-related actions in workflows
fd -e yml -e yaml . .github/workflows/ --exec grep -A 3 "uses: actions/deploy-pages\|uses: actions/configure-pages\|uses: actions/jekyll-build-pages"

# 3. Check for similar path triggers in other workflows
fd -e yml -e yaml . .github/workflows/ --exec grep -A 2 "paths:\|examples/sites"

Length of output: 913

🧰 Tools
🪛 actionlint (1.7.4)

28-28: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


38-38: the runner of "actions/configure-pages@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


57-57: the runner of "actions/deploy-pages@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 yamllint (1.35.1)

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

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

Comment on lines +33 to +34
- name: Install deps
run: pnpm -F @opentiny/vue-docs i --no-frozen-lockfile
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Use frozen lockfile for deterministic builds

Using --no-frozen-lockfile in CI/CD can lead to inconsistent builds. It's recommended to use frozen lockfile to ensure reproducible builds.

-        run: pnpm -F @opentiny/vue-docs i --no-frozen-lockfile
+        run: pnpm -F @opentiny/vue-docs i --frozen-lockfile
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Install deps
run: pnpm -F @opentiny/vue-docs i --no-frozen-lockfile
- name: Install deps
run: pnpm -F @opentiny/vue-docs i --frozen-lockfile

Comment on lines +48 to +57
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update deploy action version and add newline

The deploy job needs some minor fixes:

  1. Update to latest deploy-pages action
  2. Add newline at end of file

Apply these changes:

       - name: Deploy to GitHub Pages
         id: deployment
-        uses: actions/deploy-pages@v1
+        uses: actions/deploy-pages@v4
+
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
🧰 Tools
🪛 actionlint (1.7.4)

57-57: the runner of "actions/deploy-pages@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 yamllint (1.35.1)

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

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

Comment on lines +27 to +46
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: Install deps
run: pnpm -F @opentiny/vue-docs i --no-frozen-lockfile
- name: Build site
run: pnpm -F @opentiny/vue-docs build
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./examples/sites/dist
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v1

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update action versions and add Node.js setup

Several improvements needed in the build job:

  1. Action versions are outdated
  2. Missing Node.js setup step

Apply these changes:

       - name: Checkout
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
+      - name: Setup Node.js
+        uses: actions/setup-node@v4
+        with:
+          node-version: '18'
       - name: Setup pnpm
         uses: pnpm/action-setup@v3
         with:
           version: 8
       - name: Setup Pages
-        uses: actions/configure-pages@v2
+        uses: actions/configure-pages@v4
       - name: Upload artifact
-        uses: actions/upload-pages-artifact@v1
+        uses: actions/upload-pages-artifact@v3
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: Install deps
run: pnpm -F @opentiny/vue-docs i --no-frozen-lockfile
- name: Build site
run: pnpm -F @opentiny/vue-docs build
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./examples/sites/dist
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: Install deps
run: pnpm -F @opentiny/vue-docs i --no-frozen-lockfile
- name: Build site
run: pnpm -F @opentiny/vue-docs build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./examples/sites/dist
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
🧰 Tools
🪛 actionlint (1.7.4)

28-28: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


38-38: the runner of "actions/configure-pages@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

@kagol kagol merged commit 54e37d4 into dev Nov 30, 2024
12 of 16 checks passed
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.

1 participant