-
Notifications
You must be signed in to change notification settings - Fork 36
144 lines (125 loc) · 5.09 KB
/
publish-cloudberry-site.yml
File metadata and controls
144 lines (125 loc) · 5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# 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