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

chore: update GitHub actions version and add .nvmrc, node-version-file #179

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

DongjaJ
Copy link
Contributor

@DongjaJ DongjaJ commented Dec 15, 2024

What this PR does / why we need it?

  • update .github/workflows/*.yml's actions/checkout version 3 to 4(latest)
  • update .github/workflows/*.yml's actions/setup-node version 3 to 4(latest)
  • update .github/workflows/*.yml's actions/configure-pages version 3 to 4(latest)
  • update .github/workflows/*.yml's actions/cache version 3 to 4
  • update .github/workflows/*.yml's actions/upload-pages-artifact version 1 to 3
  • update .github/workflows/*.yml's actions/deploy-pages version 1 to 4
  • add .nvmrc node version 20 for SSOT
  • update actions/setup-node to use node-version-file instead of node-version

Any background context you want to provide?

What are the relevant tickets?

Fixes #

Checklist

  • Added relevant tests or not required
  • Didn't break anything

Summary by CodeRabbit

  • New Features

    • Introduced a new .nvmrc file to manage Node.js versioning for the project.
  • Improvements

    • Updated various GitHub Actions to their latest versions for enhanced performance and compatibility in building and deploying the Next.js site.
    • Adjusted the Node.js version specification to utilize the newly added .nvmrc file.
  • Style

    • Modified string literal syntax in the deployment workflow for consistency.

Copy link

coderabbitai bot commented Dec 15, 2024

Walkthrough

This pull request focuses on updating GitHub Actions workflows for a Next.js project. The changes primarily involve upgrading action versions from v3 to v4 in both ci.yml and deploy.yml workflow files. A new .nvmrc file has been added to specify the Node.js version, replacing hardcoded version numbers. The updates aim to modernize the CI/CD pipeline by using the latest GitHub Actions and implementing a more flexible Node.js version management approach.

Changes

File Change Summary
.github/workflows/ci.yml - Updated action versions from v3 to v4 for checkout, setup-node, configure-pages, cache, and upload-pages-artifact
- Replaced hardcoded Node.js version with .nvmrc file reference
.github/workflows/deploy.yml - Updated action versions from v1/v2/v3 to v4 for checkout, setup-node, configure-pages, cache, upload-pages-artifact, and deploy-pages
- Switched to single quotes for string literals
.nvmrc - New file added to specify Node.js version for the project

Possibly related PRs

Suggested reviewers

  • hackerwins

Poem

🐰 Workflows dancing, versions bright,
Actions upgraded with rabbit's might!
From v3 to v4, we leap and bound,
CI/CD magic, new paths are found!
Hop, hop, hooray for code so clean! 🚀

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. This feature will be included in our Pro Plan when released.


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

@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 (1)
.github/workflows/deploy.yml (1)

10-10: String literal style changes are unnecessary

The changes from double quotes to single quotes ("main"'main' and "pages"'pages') are purely stylistic and don't affect functionality.

Consider maintaining the original double quotes for consistency with other YAML files in the project.

Also applies to: 23-23

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 776f514 and 4e3e360.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml (2 hunks)
  • .github/workflows/deploy.yml (5 hunks)
  • .nvmrc (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .nvmrc
🔇 Additional comments (5)
.github/workflows/ci.yml (3)

21-21: Verify .nvmrc file exists and contains valid version

The workflow now references .nvmrc for Node.js version management, which is a good practice for version consistency.

✅ Verification successful

Node.js version configuration is properly set up

The .nvmrc file exists and contains version 20, which is a valid and currently supported LTS version of Node.js.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if .nvmrc exists and contains a valid version
if [ -f ".nvmrc" ]; then
    echo "Content of .nvmrc:"
    cat .nvmrc
else
    echo "ERROR: .nvmrc file not found"
    exit 1
fi

Length of output: 82


46-49: Review Next.js export configuration

The comment about next export deprecation is important. For Next.js 13.3.0+, the export process has changed.

Consider updating the export configuration based on your Next.js version:

  • For Next.js >= 13.3.0: Remove next export and update next.config.js with output: 'export'
  • For Next.js < 13.3.0: Keep the current configuration
✅ Verification successful

Let me verify the next.config.js configuration to provide a complete assessment.


Update Next.js export configuration for version 13.0.0

The project uses Next.js 13.0.0, which still supports and requires the next export command for static exports. The current configuration in the CI workflow is correct and should be maintained.

  • Keep the next export command in the workflow
  • The next-image-export-optimizer step is also correctly configured, matching with the image optimization settings in next.config.js
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check package.json for Next.js version
if [ -f "package.json" ]; then
    echo "Next.js version:"
    cat package.json | jq '.dependencies.next, .devDependencies.next'
fi

Length of output: 150


Script:

#!/bin/bash
# Check next.config.js content
if [ -f "next.config.js" ]; then
    echo "next.config.js content:"
    cat next.config.js
fi

Length of output: 1053


14-14: Verify action version compatibility

The updates to GitHub Actions versions are significant:

  • actions/checkout@v4
  • actions/setup-node@v4
  • actions/configure-pages@v4
  • actions/cache@v4
  • actions/upload-pages-artifact@v3

While updating to the latest versions is good practice, these are major version bumps that could introduce breaking changes.

Also applies to: 19-19, 24-24, 32-32, 51-51

✅ Verification successful

Let me check the release notes for the remaining actions to complete the verification.


Action version updates are compatible with minor implementation changes

The version updates across all GitHub Actions are safe to proceed with:

  • actions/checkout@v4: Only updates Node runtime and removes progress option
  • actions/setup-node@v4: Updates Node runtime and dependencies
  • actions/configure-pages@v4: Updates Node runtime and centralizes .node-version
  • actions/cache@v4: Updates Node runtime and adds save-always flag
  • actions/upload-pages-artifact@v3: Uses upload-artifact v4 internally

The changes are primarily internal improvements and runtime updates without breaking changes to the action interfaces. However, note that upload-pages-artifact@v3 requires deploy-pages@v4 or newer for GitHub Pages deployment.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check the changelog/release notes for breaking changes in the updated actions
gh api graphql -f query='
query {
  repository(owner: "actions", name: "checkout") {
    release(tagName: "v4.0.0") {
      description
    }
  }
}' | jq -r '.data.repository.release.description'

gh api graphql -f query='
query {
  repository(owner: "actions", name: "setup-node") {
    release(tagName: "v4.0.0") {
      description
    }
  }
}' | jq -r '.data.repository.release.description'

Length of output: 1647


Script:

#!/bin/bash
# Check release notes for configure-pages and upload-pages-artifact
gh api graphql -f query='
query {
  repository(owner: "actions", name: "configure-pages") {
    release(tagName: "v4.0.0") {
      description
    }
  }
}' | jq -r '.data.repository.release.description'

gh api graphql -f query='
query {
  repository(owner: "actions", name: "upload-pages-artifact") {
    release(tagName: "v3.0.0") {
      description
    }
  }
}' | jq -r '.data.repository.release.description'

gh api graphql -f query='
query {
  repository(owner: "actions", name: "cache") {
    release(tagName: "v4.0.0") {
      description
    }
  }
}' | jq -r '.data.repository.release.description'

Length of output: 1957

.github/workflows/deploy.yml (2)

39-39: Consistent Node.js version management

The Node.js version management using .nvmrc is consistently applied across both workflow files, which is good practice.


32-32: Verify consistency with ci.yml action versions

The action version updates match those in ci.yml, with an additional update to deploy-pages:

  • actions/checkout@v4
  • actions/setup-node@v4
  • actions/configure-pages@v4
  • actions/cache@v4
  • actions/upload-pages-artifact@v3
  • actions/deploy-pages@v4 (deploy-specific)

Also applies to: 37-37, 42-42, 50-50, 68-68, 82-82

✅ Verification successful

Action versions are consistent and compatible

The action versions in both workflows are perfectly aligned:

  • Both use identical versions for common actions (checkout@v4, setup-node@v4, configure-pages@v4, cache@v4, upload-pages-artifact@v3)
  • deploy.yml additionally uses deploy-pages@v4, which is explicitly compatible with upload-pages-artifact@v3 per the release notes
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check deploy-pages action for breaking changes
gh api graphql -f query='
query {
  repository(owner: "actions", name: "deploy-pages") {
    release(tagName: "v4.0.0") {
      description
    }
  }
}' | jq -r '.data.repository.release.description'

Length of output: 1010


Script:

#!/bin/bash
# Check action versions in ci.yml
rg "actions/.*@v\d+" .github/workflows/ci.yml

# Check action versions in deploy.yml for comparison
rg "actions/.*@v\d+" .github/workflows/deploy.yml

Length of output: 515

@krapie krapie self-requested a review December 16, 2024 03:37
@krapie krapie removed their request for review December 16, 2024 10:24
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