Skip to content

fix: add missing 'dev' script to package.json #539

fix: add missing 'dev' script to package.json

fix: add missing 'dev' script to package.json #539

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# publish-cloudberry-site.yml
#
# This workflow builds and publishes the Apache Cloudberry website to
# cloudberry.apache.org.
# The site is built using Node.js and published to the asf-site branch,
# which Apache infrastructure then serves at cloudberry.apache.org
#
# Triggered by:
# - Push to main branch: Builds and publishes to asf-site
# - Pull requests: Builds only (no publish) to verify changes
#
# Requirements:
# - Node.js project with build script in package.json
# - .asf.yaml file in repository root
#
# Notes:
# - Publication only occurs on push events, not pull requests
# - The asf-site branch is protected - only this workflow should modify it
# - Build artifacts are placed in ./build directory
name: Publish Cloudberry Site
on:
push:
branches: [ main ]
pull_request:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
# Install dependencies and build site
- name: Install dependencies
run: npm install
- name: Build site
run: |
echo "🏗️ Building Docusaurus site..."
npm run build 2>&1 | tee build.log
echo "✅ Build completed"
- name: Check for broken links in build
id: link-check
run: |
echo "🔍 Checking for broken internal links..."
# Check if build.log exists
if [ ! -f build.log ]; then
echo "❌ build.log file not found!"
echo "has_link_errors=false" >> $GITHUB_OUTPUT
exit 0
fi
# Display some build.log content for debugging
echo "📄 Build log contains $(wc -l < build.log) lines"
echo "🔍 Searching for link errors..."
# Search for broader error patterns
if grep -i "link.*couldn't.*be.*resolved\|broken.*anchor\|link.*not.*found\|markdown.*link.*error" build.log; then
echo "❌ Found potential link issues!"
# Save all possible link errors to temporary file
grep -i -A 3 -B 1 "link.*couldn't.*be.*resolved\|broken.*anchor\|link.*not.*found\|markdown.*link.*error" build.log > link_errors.txt || true
# Write to Summary
{
echo "## 🔗 Broken Links Found"
echo ""
echo "The following link issues were detected during the Docusaurus build:"
echo ""
echo '```'
cat link_errors.txt
echo '```'
} >> $GITHUB_STEP_SUMMARY
echo "has_link_errors=true" >> $GITHUB_OUTPUT
else
echo "✅ No broken internal links found"
# Write success information to Summary
{
echo "## ✅ Link Check Passed"
echo ""
echo "All internal links and anchors are working correctly!"
} >> $GITHUB_STEP_SUMMARY
echo "has_link_errors=false" >> $GITHUB_OUTPUT
fi
# Debug info: check if Summary was written successfully
if [ -s "$GITHUB_STEP_SUMMARY" ]; then
echo "✅ Summary information written successfully"
else
echo "⚠️ Warning: Summary file is empty or doesn't exist"
fi
- name: Copy ASF config
run: cp .asf.yaml build/.asf.yaml
# Deploy to asf-site for production
- name: Deploy to production
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
publish_branch: asf-site
# Final step: fail if there were link errors
- name: Report link check results
if: always()
run: |
if [[ "${{ steps.link-check.outputs.has_link_errors }}" == "true" ]]; then
echo "❌ Workflow completed but with broken links detected!"
echo "Please fix the broken internal links before merging."
echo "Check the Summary tab above for detailed error information."
exit 1
else
echo "✅ All checks passed successfully!"
fi