Skip to content

Commit 0fab5f6

Browse files
committed
ci(website): automates Hugo build and deployment
Introduces a GitHub Actions workflow to build the wiki and deploy it to the project's GitHub Pages repository. Ensures the live site stays in sync with changes in the main repository while keeping build artifacts out of version control. Provides documentation on the deployment process and necessary repository secrets.
1 parent e3914dd commit 0fab5f6

3 files changed

Lines changed: 58 additions & 1 deletion

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Deploy Website
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'website/**'
8+
- '.github/workflows/deploy-website.yml'
9+
workflow_dispatch:
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout source
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Hugo
19+
uses: peaceiris/actions-hugo@v3
20+
with:
21+
hugo-version: '0.161.1'
22+
extended: true
23+
24+
- name: Build wiki
25+
run: |
26+
cd website/source
27+
hugo --baseURL="/wiki/" --destination="../wiki"
28+
29+
- name: Stage publish directory
30+
run: |
31+
mkdir -p _publish
32+
cp -r website/index.html website/img website/wiki _publish/
33+
if [ -f website/README.md ]; then cp website/README.md _publish/; fi
34+
35+
- name: Deploy to class-pollution.github.io
36+
uses: peaceiris/actions-gh-pages@v4
37+
with:
38+
personal_token: ${{ secrets.DEPLOY_TOKEN }}
39+
external_repository: class-pollution/class-pollution.github.io
40+
publish_branch: main
41+
publish_dir: ./_publish
42+
force_orphan: true
43+
user_name: 'github-actions[bot]'
44+
user_email: 'github-actions[bot]@users.noreply.github.com'
45+
commit_message: 'Deploy website from python-class-pollution@${{ github.sha }}'

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@ output/**
1717
node_modules
1818
.claude
1919
.vscode
20-
dataset/github/python-20141001-20241001-star-100-1K.json
20+
dataset/github/python-20141001-20241001-star-100-1K.json
21+
22+
# Generated wiki output (built from website/source/ by Hugo CI)
23+
website/wiki/

website/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,12 @@ hugo --baseURL="/wiki/" --destination="../wiki"
4040
```
4141

4242
This generates the static site under `website/wiki/`.
43+
44+
## Deployment
45+
46+
The site is deployed to <https://class-pollution.github.io> via the GitHub Actions workflow at `.github/workflows/deploy-website.yml`. On every push to `main` that touches `website/`, the workflow:
47+
48+
1. Builds the wiki with Hugo into `website/wiki/`
49+
2. Pushes `index.html`, `img/`, and `wiki/` to the `class-pollution/class-pollution.github.io` repo
50+
51+
The workflow uses a `DEPLOY_TOKEN` repository secret (a fine-grained PAT with write access to the target repo).

0 commit comments

Comments
 (0)