Skip to content

Conversation

@prashantchauhan-12
Copy link
Contributor

Fix: Sitemap Not Updating in CI/CD

🐛 The Problem

The user reported that sitemap.xml was buggy or not being read correctly by Google Search Console.
Upon investigation, it was found that the deployed sitemap.xml might be stale or not reflecting the latest routes because the generation script was not running during the automated deployment.

🔍 Root Cause Analysis

In package.json, the build script is defined as:

"build": "npm run generate:sitemap && next build"

This script ensures that the sitemap is regenerated before the Next.js build occurs.

However, the GitHub Actions workflow (.github/workflows/release.yml) was explicitly running:

run: npx next build

By running next build directly via npx, the CI pipeline was bypassing the npm run generate:sitemap step defined in package.json. Consequently, the sitemap in the out/ directory was either missing, stale, or relying on a previously committed version.

🛠 The Solution

I have updated the .github/workflows/release.yml file to use the project's defined build script instead of the default Next.js command.

Change:

- run: npx next build
+ run: npm run build

✅ Verification Steps

To verify this fix:

  1. Merge this pull request.
  2. Go to the Actions tab in GitHub.
  3. Open the running Release and Build workflow.
  4. Click on the build step.
  5. Verify that you see the output ✅ Sitemap generated... in the logs before the Next.js build starts.
  6. Once deployed, check https://physicshub.github.io/sitemap.xml to ensure it matches the latest content.

@mattqdev mattqdev merged commit e985114 into physicshub:main Jan 27, 2026
1 check passed
@physicshub
Copy link
Owner

🎉 This PR is included in version 3.22.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@prashantchauhan-12 prashantchauhan-12 deleted the fix/sitemap-issue branch January 27, 2026 14:21
@mattqdev
Copy link
Collaborator

Sorry hasn't changed nothing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants