Skip to content

Commit 03cae7b

Browse files
author
InfoTech.io Bot
committed
Add fixed Hugo deployment workflow
- Simplified Hugo build process without complex factory - Direct Hugo site creation with custom layouts - Fallback index page if build fails - Step-by-step build process for debugging 🤖 Generated with Claude Code
1 parent 2cdc249 commit 03cae7b

1 file changed

Lines changed: 243 additions & 0 deletions

File tree

Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
name: Deploy InfoTech.io Sites (Fixed)
2+
3+
on:
4+
repository_dispatch:
5+
types: [
6+
corporate-site-updated,
7+
quiz-docs-updated,
8+
hugo-docs-updated,
9+
web-terminal-docs-updated,
10+
cli-docs-updated
11+
]
12+
workflow_dispatch:
13+
inputs:
14+
site:
15+
description: 'Which site to rebuild (all, corporate, quiz, hugo, terminal, cli)'
16+
required: false
17+
default: 'corporate'
18+
19+
permissions:
20+
contents: read
21+
pages: write
22+
id-token: write
23+
24+
concurrency:
25+
group: "pages"
26+
cancel-in-progress: false
27+
28+
jobs:
29+
build:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout hub repository
33+
uses: actions/checkout@v4
34+
35+
- name: Setup Hugo
36+
uses: peaceiris/actions-hugo@v2
37+
with:
38+
hugo-version: '0.110.0'
39+
extended: true
40+
41+
- name: Setup Pages
42+
id: pages
43+
uses: actions/configure-pages@v4
44+
45+
- name: Checkout content repositories
46+
run: |
47+
# Use GITHUB_TOKEN for public repositories
48+
echo "🔄 Cloning content repositories..."
49+
50+
git clone https://github.com/info-tech-io/info-tech.git content-corporate
51+
git clone https://github.com/info-tech-io/quiz.git content-quiz
52+
git clone https://github.com/info-tech-io/hugo-templates.git content-hugo-templates
53+
git clone https://github.com/info-tech-io/web-terminal.git content-web-terminal
54+
git clone https://github.com/info-tech-io/info-tech-cli.git content-cli
55+
56+
echo "✅ All repositories cloned"
57+
58+
- name: Checkout hugo-templates for building
59+
uses: actions/checkout@v4
60+
with:
61+
repository: info-tech-io/hugo-templates
62+
path: hugo-templates
63+
64+
- name: Prepare build environment
65+
run: |
66+
mkdir -p build-output
67+
cd hugo-templates
68+
npm install || echo "npm install failed, continuing..."
69+
70+
- name: Build Corporate Site
71+
if: ${{ github.event.inputs.site == 'all' || github.event.inputs.site == 'corporate' || github.event_name == 'repository_dispatch' }}
72+
run: |
73+
echo "🏢 Building Corporate Site..."
74+
75+
# Create a simple Hugo site for corporate content
76+
mkdir -p corporate-site
77+
cd corporate-site
78+
79+
# Initialize Hugo site
80+
hugo new site . --force
81+
82+
# Copy content
83+
if [ -d "../content-corporate/docs/content" ]; then
84+
cp -r ../content-corporate/docs/content/* ./content/ 2>/dev/null || echo "No content to copy"
85+
fi
86+
87+
# Create simple config
88+
cat > hugo.toml << EOF
89+
baseURL = 'https://info-tech-io.github.io'
90+
languageCode = 'ru'
91+
title = 'InfoTech.io - Open Source Educational Technology'
92+
theme = ''
93+
94+
[markup]
95+
[markup.goldmark]
96+
[markup.goldmark.renderer]
97+
unsafe = true
98+
EOF
99+
100+
# Create simple layout
101+
mkdir -p layouts/_default
102+
cat > layouts/_default/baseof.html << 'EOF'
103+
<!DOCTYPE html>
104+
<html>
105+
<head>
106+
<meta charset="utf-8">
107+
<title>{{ .Title }} - InfoTech.io</title>
108+
<meta name="description" content="{{ .Description | default .Summary }}">
109+
<style>
110+
body { font-family: Arial, sans-serif; margin: 40px; line-height: 1.6; }
111+
.container { max-width: 800px; margin: 0 auto; }
112+
.header { color: #333; border-bottom: 2px solid #eee; padding-bottom: 10px; }
113+
nav { margin: 20px 0; }
114+
nav a { margin-right: 15px; text-decoration: none; color: #0066cc; }
115+
.content { margin: 30px 0; }
116+
footer { margin-top: 50px; padding-top: 20px; border-top: 1px solid #eee; color: #666; }
117+
</style>
118+
</head>
119+
<body>
120+
<div class="container">
121+
<header class="header">
122+
<h1><a href="/" style="text-decoration: none; color: inherit;">InfoTech.io</a></h1>
123+
<nav>
124+
<a href="/">Home</a>
125+
<a href="/quiz/">Quiz Engine</a>
126+
<a href="/hugo/">Hugo Templates</a>
127+
<a href="/terminal/">Web Terminal</a>
128+
<a href="/cli/">CLI Tools</a>
129+
</nav>
130+
</header>
131+
132+
<main class="content">
133+
{{ block "main" . }}{{ end }}
134+
</main>
135+
136+
<footer>
137+
<p>🤖 Built with <a href="https://gohugo.io/">Hugo</a> and <a href="https://claude.ai/code">Claude Code</a></p>
138+
</footer>
139+
</div>
140+
</body>
141+
</html>
142+
EOF
143+
144+
cat > layouts/_default/single.html << 'EOF'
145+
{{ define "main" }}
146+
<article>
147+
<h1>{{ .Title }}</h1>
148+
{{ .Content }}
149+
</article>
150+
{{ end }}
151+
EOF
152+
153+
cat > layouts/_default/list.html << 'EOF'
154+
{{ define "main" }}
155+
<h1>{{ .Title }}</h1>
156+
{{ .Content }}
157+
{{ range .Pages }}
158+
<article style="margin: 20px 0; padding: 15px; border: 1px solid #eee;">
159+
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
160+
<p>{{ .Summary }}</p>
161+
</article>
162+
{{ end }}
163+
{{ end }}
164+
EOF
165+
166+
cat > layouts/index.html << 'EOF'
167+
{{ define "main" }}
168+
<h1>{{ .Title }}</h1>
169+
{{ .Content }}
170+
{{ end }}
171+
EOF
172+
173+
# Build with Hugo
174+
hugo --minify --destination ../build-output
175+
176+
echo "✅ Corporate site built"
177+
178+
- name: Create fallback index if needed
179+
run: |
180+
if [ ! -f "build-output/index.html" ]; then
181+
echo "📝 Creating fallback index..."
182+
cat > build-output/index.html << 'EOF'
183+
<!DOCTYPE html>
184+
<html>
185+
<head>
186+
<meta charset="utf-8">
187+
<title>InfoTech.io - Open Source Educational Technology</title>
188+
<style>
189+
body { font-family: Arial, sans-serif; margin: 40px; }
190+
.container { max-width: 800px; margin: 0 auto; }
191+
.header { color: #333; }
192+
.status { color: #28a745; }
193+
.links { margin-top: 30px; }
194+
.links a { display: block; margin: 10px 0; }
195+
</style>
196+
</head>
197+
<body>
198+
<div class="container">
199+
<h1 class="header">InfoTech.io</h1>
200+
<p class="status">🚀 Open Source Educational Technology Organization</p>
201+
202+
<h2>Our Mission</h2>
203+
<p>We create open educational technologies that make quality IT education accessible to everyone.</p>
204+
205+
<h2>Our Products</h2>
206+
<div class="links">
207+
<a href="https://infotecha.ru">🎓 ИНФОТЕКА - Educational Platform</a>
208+
<a href="/quiz/">📝 Quiz Engine Documentation</a>
209+
<a href="/hugo/">🏗️ Hugo Templates Documentation</a>
210+
<a href="/terminal/">💻 Web Terminal Documentation</a>
211+
<a href="/cli/">⚙️ CLI Tools Documentation</a>
212+
</div>
213+
214+
<h2>For Developers</h2>
215+
<div class="links">
216+
<a href="https://github.com/info-tech-io">🐙 GitHub Organization</a>
217+
<a href="https://github.com/info-tech-io/info-tech">📚 Contributing Guide</a>
218+
</div>
219+
220+
<footer style="margin-top: 50px; padding-top: 20px; border-top: 1px solid #eee; color: #666;">
221+
<p>🤖 Built with Hugo and Claude Code</p>
222+
</footer>
223+
</div>
224+
</body>
225+
</html>
226+
EOF
227+
fi
228+
229+
- name: Upload artifact
230+
uses: actions/upload-pages-artifact@v3
231+
with:
232+
path: build-output
233+
234+
deploy:
235+
environment:
236+
name: github-pages
237+
url: ${{ steps.deployment.outputs.page_url }}
238+
runs-on: ubuntu-latest
239+
needs: build
240+
steps:
241+
- name: Deploy to GitHub Pages
242+
id: deployment
243+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)