weeee💃
Some checks are pending
Build and Deploy Blog / build (push) Waiting to run

This commit is contained in:
mohamad 2025-01-26 02:04:29 +01:00
commit f4a3e2379e
6 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,25 @@
name: Build and Deploy Blog
on: [push]
jobs:
build:
runs-on: docker
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Pandoc
run: |
apt-get update
apt-get install -y pandoc
- name: Build site
run: |
chmod +x scripts/build.sh
./scripts/build.sh
- name: Deploy to Pages
uses: actions/pages@v1
with:
target: 'public'
keep_files: false

26
assets/css/style.css Normal file
View File

@ -0,0 +1,26 @@
body {
font-family: Arial, sans-serif;
line-height: 1.6;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
header {
border-bottom: 1px solid #ccc;
margin-bottom: 30px;
padding-bottom: 10px;
}
nav a {
margin-right: 15px;
text-decoration: none;
color: #333;
}
footer {
margin-top: 50px;
border-top: 1px solid #ccc;
padding-top: 10px;
color: #666;
}

12
posts/first-post.md Normal file
View File

@ -0,0 +1,12 @@
# My First Blog Post
Welcome to my blog! This is my first post.
## Subheading
Here's some content:
- List item 1
- List item 2
- List item 3
**Bold text** and *italic text*

32
scripts/build.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# Create public directory if not exists
mkdir -p public
# Copy assets
cp -r assets public/
# Process posts
for post in posts/*.md; do
# Get base name
filename=$(basename "$post" .md)
# Convert markdown to HTML
pandoc "$post" \
--template templates/post.html \
--metadata pagetitle="$(head -n 1 "$post" | sed 's/# //')" \
-o "public/${filename}.html"
done
# Generate index page
echo "<!DOCTYPE html>" > public/index.html
echo "<html lang='en'>" >> public/index.html
pandoc templates/index.html >> public/index.html
echo "<ul>" >> public/index.html
for post in posts/*.md; do
title=$(head -n 1 "$post" | sed 's/# //')
filename=$(basename "$post" .md)
echo "<li><a href='${filename}.html'>$title</a></li>" >> public/index.html
done
echo "</ul>" >> public/index.html
echo "</html>" >> public/index.html

15
templates/index.html Normal file
View File

@ -0,0 +1,15 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Blog</title>
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<header>
<h1>Welcome to My Blog</h1>
<nav>
<a href="/index.html">Home</a>
</nav>
</header>
<main>
<h2>Latest Posts</h2>

23
templates/post.html Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>$pagetitle$</title>
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<header>
<h1>My Blog</h1>
<nav>
<a href="/index.html">Home</a>
</nav>
</header>
<main>
$body$
</main>
<footer>
<p>© 2023 My Blog</p>
</footer>
</body>
</html>