Skip to content

Commit 9623e0f

Browse files
committed
init
0 parents  commit 9623e0f

25 files changed

+7352
-0
lines changed

.blogrc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Blog configuration file
2+
# Source this file to set environment variables for the build
3+
4+
# Blog metadata
5+
export BLOG_TITLE="My Blog"
6+
export BLOG_AUTHOR="bytenoob"
7+
export BLOG_EMAIL="chouyc.adam # gmail.com"
8+
export BLOG_URL="https://bytenoob.io"
9+
export BLOG_DESCRIPTION="A technical blog about programming and technology"
10+
11+
# Build options
12+
export MINIFY_ASSETS="true" # Set to true for production
13+
export GENERATE_RSS="true"
14+
export GENERATE_SITEMAP="true"
15+
16+
# Paths (relative to blog directory)
17+
export POSTS_DIR="posts"
18+
export STATIC_DIR="static"
19+
export TEMPLATES_DIR="templates"
20+
export PUBLIC_DIR="public"
21+
22+
# Theme/styling
23+
export THEME_PRIMARY_COLOR="#D4A27F"
24+
export THEME_FONT_FAMILY="Inter"
25+
26+
# SEO/Social
27+
export GITHUB_USERNAME="bufrr"
28+
29+
# Development
30+
export SERVE_PORT="8000"
31+
export LIVE_RELOAD="true"

.github/workflows/ci.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out
14+
uses: actions/checkout@v4
15+
16+
- name: Install Emacs
17+
run: |
18+
sudo apt-add-repository ppa:ubuntu-elisp/ppa -y
19+
sudo apt update
20+
sudo apt-get install emacs-snapshot -y
21+
22+
- name: Check Org files syntax
23+
run: |
24+
echo "🔍 Checking Org files syntax..."
25+
for file in posts/*.org; do
26+
if [ -f "$file" ]; then
27+
echo "Checking: $file"
28+
emacs --batch --eval "(progn (find-file \"$file\") (org-lint))" 2>&1 | grep -E "(Warning|Error)" || true
29+
fi
30+
done
31+
32+
- name: Validate metadata
33+
run: |
34+
echo "📋 Validating post metadata..."
35+
for file in posts/*.org; do
36+
if [ -f "$file" ] && [[ "$file" != "posts/index.org" ]] && [[ "$file" != "posts/about.org" ]] && [[ "$file" != "posts/404.org" ]]; then
37+
echo "Checking: $file"
38+
# Check for required metadata
39+
if ! grep -q "^#\\+TITLE:" "$file"; then
40+
echo "❌ Missing TITLE in $file"
41+
exit 1
42+
fi
43+
if ! grep -q "^#\\+AUTHOR:" "$file"; then
44+
echo "❌ Missing AUTHOR in $file"
45+
exit 1
46+
fi
47+
if ! grep -q "^#\\+DATE:" "$file"; then
48+
echo "❌ Missing DATE in $file"
49+
exit 1
50+
fi
51+
fi
52+
done
53+
echo "✅ All metadata valid"
54+
55+
shellcheck:
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Check out
59+
uses: actions/checkout@v4
60+
61+
- name: Run ShellCheck
62+
uses: ludeeus/action-shellcheck@master
63+
with:
64+
scandir: '.'
65+
format: gcc
66+
severity: warning
67+
68+
build-test:
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Check out
72+
uses: actions/checkout@v4
73+
74+
- name: Setup Node.js
75+
uses: actions/setup-node@v4
76+
with:
77+
node-version: '20'
78+
79+
- name: Install Emacs
80+
run: |
81+
sudo apt-add-repository ppa:ubuntu-elisp/ppa -y
82+
sudo apt update
83+
sudo apt-get install emacs-snapshot -y
84+
85+
- name: Test build
86+
run: |
87+
chmod +x build.sh
88+
./build.sh
89+
env:
90+
CI: true
91+
92+
- name: Validate HTML output
93+
run: |
94+
echo "🔍 Validating HTML files..."
95+
# Check that index.html exists
96+
if [ ! -f "public/index.html" ]; then
97+
echo "❌ public/index.html not found"
98+
exit 1
99+
fi
100+
101+
# Check that all expected HTML files exist
102+
for org_file in posts/*.org; do
103+
if [ -f "$org_file" ] && [[ "$org_file" != "posts/404.org" ]]; then
104+
base_name=$(basename "$org_file" .org)
105+
html_file="public/${base_name}.html"
106+
if [ ! -f "$html_file" ]; then
107+
echo "❌ Expected $html_file not found"
108+
exit 1
109+
fi
110+
fi
111+
done
112+
113+
echo "✅ All HTML files generated successfully"
114+
115+
- name: Check for broken internal links
116+
run: |
117+
echo "🔗 Checking for broken internal links..."
118+
cd public
119+
broken_links=0
120+
for html_file in *.html; do
121+
# Extract internal links
122+
links=$(grep -oP 'href="[^"]*\.html"' "$html_file" | sed 's/href="//;s/"//' | sort -u)
123+
for link in $links; do
124+
if [[ ! "$link" =~ ^https?:// ]] && [ ! -f "$link" ]; then
125+
echo "❌ Broken link in $html_file: $link"
126+
broken_links=$((broken_links + 1))
127+
fi
128+
done
129+
done
130+
131+
if [ $broken_links -gt 0 ]; then
132+
echo "❌ Found $broken_links broken links"
133+
exit 1
134+
else
135+
echo "✅ No broken internal links found"
136+
fi

.github/workflows/pr-preview.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: PR Preview
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
env:
8+
BLOG_URL: 'https://pr-${{ github.event.pull_request.number }}.preview.example.com'
9+
BLOG_AUTHOR: ${{ secrets.BLOG_AUTHOR || 'bytenoob' }}
10+
BLOG_EMAIL: ${{ secrets.BLOG_EMAIL || 'blog@example.com' }}
11+
MINIFY_ASSETS: 'false'
12+
13+
jobs:
14+
preview:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
25+
- name: Install Node.js dependencies
26+
run: |
27+
if [ -f package.json ]; then
28+
npm ci
29+
else
30+
npm install -g terser cssnano postcss postcss-cli
31+
fi
32+
33+
- name: Cache Emacs packages
34+
uses: actions/cache@v4
35+
with:
36+
path: |
37+
~/.emacs.d/.local/straight
38+
~/.emacs.d/.local/cache
39+
key: ${{ runner.os }}-emacs-${{ hashFiles('**/packages.el') }}
40+
restore-keys: |
41+
${{ runner.os }}-emacs-
42+
43+
- name: Install Emacs
44+
run: |
45+
sudo apt-add-repository ppa:ubuntu-elisp/ppa -y
46+
sudo apt update
47+
sudo apt-get install emacs-snapshot -y
48+
49+
- name: Build the site
50+
run: |
51+
chmod +x build.sh
52+
./build.sh
53+
env:
54+
CI: true
55+
56+
- name: Generate sitemap
57+
run: |
58+
if [ -f generate-sitemap.sh ]; then
59+
chmod +x generate-sitemap.sh
60+
./generate-sitemap.sh
61+
fi
62+
63+
- name: Upload preview artifact
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: preview-${{ github.event.pull_request.number }}
67+
path: public
68+
retention-days: 7
69+
70+
- name: Comment PR
71+
uses: actions/github-script@v7
72+
with:
73+
script: |
74+
const artifactUrl = `https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
75+
const comment = `## 🔍 Preview Build Complete!
76+
77+
Build #${{ github.run_number }} has finished successfully.
78+
79+
📦 [Download preview artifact](${artifactUrl})
80+
81+
### Build Statistics:
82+
- Total HTML files: \`$(find public -name "*.html" | wc -l)\`
83+
- Build size: \`$(du -sh public | cut -f1)\`
84+
`;
85+
86+
github.rest.issues.createComment({
87+
issue_number: context.issue.number,
88+
owner: context.repo.owner,
89+
repo: context.repo.repo,
90+
body: comment
91+
});

.github/workflows/publish.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Publish to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
env:
10+
BLOG_URL: ${{ secrets.BLOG_URL || 'https://bytenoob.github.io/blog' }}
11+
BLOG_AUTHOR: ${{ secrets.BLOG_AUTHOR || 'bytenoob' }}
12+
BLOG_EMAIL: ${{ secrets.BLOG_EMAIL || 'blog@example.com' }}
13+
MINIFY_ASSETS: 'true'
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
pages: write
21+
id-token: write
22+
steps:
23+
- name: Check out
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20'
30+
cache: 'npm'
31+
cache-dependency-path: '**/package-lock.json'
32+
33+
- name: Install Node.js dependencies
34+
run: |
35+
if [ -f package.json ]; then
36+
npm ci
37+
else
38+
npm install -g terser cssnano postcss postcss-cli
39+
fi
40+
41+
- name: Cache Emacs packages
42+
uses: actions/cache@v4
43+
with:
44+
path: |
45+
~/.emacs.d/.local/straight
46+
~/.emacs.d/.local/cache
47+
key: ${{ runner.os }}-emacs-${{ hashFiles('**/packages.el') }}
48+
restore-keys: |
49+
${{ runner.os }}-emacs-
50+
51+
- name: Install Emacs
52+
run: |
53+
sudo apt-add-repository ppa:ubuntu-elisp/ppa -y
54+
sudo apt update
55+
sudo apt-get install emacs-snapshot -y
56+
echo "Emacs version: $(emacs --version | head -n1)"
57+
58+
- name: Build the site
59+
run: |
60+
chmod +x build.sh
61+
./build.sh
62+
env:
63+
CI: true
64+
65+
- name: Generate sitemap
66+
run: |
67+
if [ -f generate-sitemap.sh ]; then
68+
chmod +x generate-sitemap.sh
69+
./generate-sitemap.sh
70+
fi
71+
72+
- name: Minify assets for production
73+
if: github.ref == 'refs/heads/main'
74+
run: |
75+
if [ -f minify.sh ]; then
76+
chmod +x minify.sh
77+
./minify.sh
78+
fi
79+
80+
- name: List generated files
81+
run: |
82+
echo "📁 Generated files:"
83+
find public -type f -name "*.html" | sort
84+
echo ""
85+
echo "📊 Build statistics:"
86+
echo "Total HTML files: $(find public -name "*.html" | wc -l)"
87+
echo "Total size: $(du -sh public | cut -f1)"
88+
89+
- name: Setup Pages
90+
uses: actions/configure-pages@v4
91+
92+
- name: Upload artifact
93+
uses: actions/upload-pages-artifact@v3
94+
with:
95+
path: public
96+
97+
- name: Deploy to GitHub Pages
98+
id: deployment
99+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)