Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Deploy GitHub Pages

on:
pull_request:
types: [closed]
branches:
- master

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v4
with:
ref: master

- uses: pnpm/action-setup@v4
with:
version: 10

- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
env:
VITE_GITHUB_TOKEN: ${{ secrets.VITE_GITHUB_TOKEN }}
run: pnpm build

- uses: actions/upload-pages-artifact@v3
with:
path: dist

deploy:
if: github.event.pull_request.merged == true
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
node_modules/
dist
92 changes: 89 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,93 @@
# cederache.github.io

This is a personal website generated with [gitfolio](https://github.com/imfunniee/gitfolio)
Personal site hosted on [GitHub Pages](https://pages.github.com/). It shows a hero section, a live list of public repositories from the GitHub API, and an about/contact area.

The Github repositories are automatically refreshed.
## Stack

To serve website, run `npm run serve`
- [Vite](https://vitejs.dev/) + [React](https://react.dev/) 18 + [TypeScript](https://www.typescriptlang.org/)
- [Tailwind CSS](https://tailwindcss.com/) and [shadcn/ui](https://ui.shadcn.com/) (Radix primitives)
- [TanStack Query](https://tanstack.com/query) for GitHub API data
- [React Router](https://reactrouter.com/) for routing
- [Vitest](https://vitest.dev/) and [Testing Library](https://testing-library.com/react) for unit tests

## Prerequisites

- Node.js (LTS recommended)
- [pnpm](https://pnpm.io/) — the repo pins a `packageManager` version in `package.json`

## Setup

```bash
pnpm install
```

## Development

```bash
pnpm dev
```

The dev server listens on port **8080** (see `vite.config.ts`).

## Build

```bash
pnpm build
```

Output goes to `dist/`. Preview the production build with `pnpm preview`.

## Deploy to GitHub Pages ([gh-pages](https://www.npmjs.com/package/gh-pages))

This mirrors the flow from [gitname/react-gh-pages](https://github.com/gitname/react-gh-pages), adapted for **Vite** (build output is `dist/`, not `build/`) and a **user site** repo (`username.github.io`), where `homepage` is `https://cederache.github.io` with no repository path segment.

1. **One-time:** In the GitHub repo → **Settings** → **Pages** → **Build and deployment**: source **Deploy from a branch**, branch **`gh-pages`** folder **`/ (root)`**, then Save.
2. Ensure your local `origin` remote points at this repository (same as the tutorial’s step 6).
3. From the project root:

```bash
pnpm run deploy
```

(`pnpm deploy` is a different pnpm command; use `run deploy` for this script.)

That runs `predeploy` (production build) then pushes the contents of `dist/` to the `gh-pages` branch. Optional custom commit message:

```bash
pnpm run deploy -- -m "Deploy site"
```

Keep deploying **source** on your default branch (`git push`) separately from `pnpm run deploy`, which only updates the **`gh-pages`** branch with the built site.

## Environment variables

| Variable | Required | Purpose |
|----------|----------|---------|
| `VITE_GITHUB_TOKEN` | No | GitHub personal access token (classic fine-grained with `public_repo` or read-only repo scope). Without it, the app uses unauthenticated API calls, which have a lower rate limit. |

Create a `.env` or `.env.local` in the project root (do not commit secrets):

```bash
VITE_GITHUB_TOKEN=ghp_...
```

## Scripts

| Command | Description |
|---------|-------------|
| `pnpm dev` | Start Vite dev server |
| `pnpm build` | Production build |
| `pnpm build:dev` | Build in development mode |
| `pnpm preview` | Serve `dist/` locally |
| `pnpm lint` | Run ESLint |
| `pnpm test` | Run Vitest once |
| `pnpm test:watch` | Vitest watch mode |
| `pnpm run deploy` | Build and publish `dist/` to the `gh-pages` branch |

## Project layout

- `src/` — application code (`pages/`, `components/`, `hooks/`, etc.)
- `public/` — static assets served as-is
- `index.html` — Vite entry HTML

Repository data is fetched for the GitHub user `cederache`; adjust `GITHUB_USERNAME` in `src/hooks/useGitHubRepos.ts` if you fork this for another account.
9 changes: 0 additions & 9 deletions blog/list.json

This file was deleted.

Binary file removed blog/my-first-post/scotland.JPG
Binary file not shown.
Loading
Loading