672 words
3 minutes
GitHub Pages Setup

πŸ“˜ ShadowNotes – Deploy Fuwari Blog to GitHub Pages#

A quick, step-by-step guide to set up and deploy your Fuwari Astro blog on GitHub Pages.


πŸš€ How GitHub Pages Works#

To understand GitHub Pages, let’s imagine hosting a website on your local machine. You set up an Apache server and your site runs perfectly. But when you upload the same website to GitHub Pages, it doesn’t run automatically. Why? πŸ€”

On your local machine, the Apache server handles the website. GitHub Pages also provides a server automatically, but for more complex websites, you need a configuration file to tell GitHub how to deploy your site. This is done using a GitHub Actions workflow file like deploy.yml.

βš™οΈ Example deploy.yml#

name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: peaceiris/actions-gh-pages@v7
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./

πŸ’‘ Simplified Explanation#

Think of GitHub as a separate machine for every repository. To host and run your website on that machine, you need a deploy file (deploy.yml) to configure it properly.

  • The workflow automatically builds and publishes your site whenever you push updates to the main branch.

  • This ensures your website runs correctly on GitHub Pages without manual server setup.


βœ… Requirements#

Before starting, ensure the following are installed on your system:

Terminal window
node
npm
pnpm

πŸ”§ Installation#

Before starting, make sure Node.js and NPM are installed on your system.

1️⃣ Install Node.js and NPM#

Go to the official Node.js website.

  • Download the LTS version (recommended for most users)
  • Run the installer and follow the prompts.

This automatically installs Node.js and NPM.

Verify installation#

Terminal window
node -v # Should show version >= 20
npm -v # Should show version >= 9

2️⃣ Install PNPM Globally#

PNPM is a fast and efficient Node.js package manager used by Fuwari:

Terminal window
npm install -g pnpm
pnpm -v # Verify PNPM installation

βœ… Now your system is ready to install dependencies and run Fuwari.


🌍 Deploy on GitHub Pages#

1️⃣ Create Repo#

Terminal window
# On GitHub β†’ New Repository β†’ "blogs" (Public)

2️⃣ Clone Repo#

Terminal window
git clone https://github.com/username/blogs.git
cd blogs

3️⃣ Install Fuwari#

Terminal window
pnpm create fuwari@latest .
cd <created dir>
pnpm install
Terminal window
pnpm dev

πŸ‘‰ Open in browser: http://localhost:4321


πŸ“ Customize Your Blog#

  • src/config.ts β†’ Site config (site name, links, theme, etc.)
  • src/content/spec/about.md β†’ About page (edit your profile details)
  • astro.config.mjs β†’ Astro settings (update site URL for GitHub Pages)
  • public/favicon/* β†’ Favicons (replace with your own logo)

πŸ› οΈ Useful pnpm Commands#

Terminal window
pnpm new-post my-first-post # create new post
pnpm build && pnpm preview # build for production
pnpm dev # run dev server

4️⃣ Update Astro Config#

astro.config.mjs

import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
export default defineConfig({
site: 'https://username.github.io/blogs', // GitHub Pages URL
base: '/blogs/', // repo name
integrations: [tailwind()],
});

5️⃣ GitHub Actions Workflow#

Create .github/workflows/deploy.yml

name: Deploy Astro Blog to GitHub Pages
on:
push:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@v2
with:
version: 9
- run: pnpm install
- run: pnpm build
- uses: actions/upload-artifact@v4
with:
name: github-pages
path: ./dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- uses: actions/download-artifact@v4
with:
name: github-pages
path: ./dist
- id: deploy
uses: actions/deploy-pages@v4
with:
artifact_name: github-pages

πŸ“ Note#

The workflow file deploy.yml is the key configuration that sets up and builds the environment for your GitHub Pages site.

  • You can think of it like a Dockerfile: it automates the environment setup, ensuring your site runs smoothly without manual intervention.

6️⃣ Build and Test Locally#

Terminal window
pnpm build && pnpm preview

7️⃣ Push to GitHub#

Terminal window
git init
git add .
git commit -m "Setup Fuwari Blog with GitHub Pages"
git checkout -b main
git remote add origin https://github.com/username/notes.git
git push origin main

8️⃣ Enable GitHub Pages#

  1. Go to your repository β†’ Settings β†’ Pages.
  2. Under Build and Deployment, select:
    • Source β†’ GitHub Actions
  3. Click Save βœ…

πŸŽ‰ Result#

Your blog is live at:

πŸ‘‰ https://username.github.io/blogs

Summary#

  • Installed Node.js, NPM, and PNPM to set up the environment for Fuwari Astro blog
  • Created and cloned a GitHub repository for deployment
  • Installed Fuwari, configured site settings, and customized content (config.ts, about.md, favicons)
  • Built and ran the blog locally using pnpm dev and pnpm build
  • Configured GitHub Actions workflow to automate deployment to GitHub Pages
  • Pushed changes to GitHub and enabled GitHub Pages to publish the blog online
GitHub Pages Setup
https://0xshadowman.github.io/notes/posts/github-pages-setup/
Author
MD Shohanur Rahman
Published at
2025-09-13
License
CC BY-NC-SA 4.0