Skip to content

Commit 8a68e7a

Browse files
committed
chore: prepare cloudflare website release flow
1 parent 1f866c4 commit 8a68e7a

10 files changed

Lines changed: 149 additions & 28 deletions

File tree

.github/workflows/main.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,19 @@ jobs:
4848
- name: Check out
4949
uses: actions/checkout@v6
5050

51-
- name: Set up the environment
52-
uses: ./.github/actions/setup-python-env
51+
- name: Set up Node
52+
uses: actions/setup-node@v6
53+
with:
54+
node-version-file: website/.node-version
55+
cache: pnpm
56+
cache-dependency-path: website/pnpm-lock.yaml
57+
58+
- name: Set up pnpm
59+
uses: pnpm/action-setup@v4
60+
with:
61+
version: 10
5362

5463
- name: Check if documentation can be built
55-
run: uv run mkdocs build -s
64+
run: |
65+
pnpm --dir website install --frozen-lockfile
66+
pnpm --dir website build

.github/workflows/on-release-main.yml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,43 @@ jobs:
4444
env:
4545
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
4646

47-
deploy-docs:
47+
deploy-website:
4848
needs: publish
4949
runs-on: ubuntu-latest
5050
permissions:
51-
contents: write
51+
contents: read
52+
deployments: write
5253
steps:
5354
- name: Check out
5455
uses: actions/checkout@v6
5556

56-
- name: Set up the environment
57-
uses: ./.github/actions/setup-python-env
57+
- name: Set up Node
58+
uses: actions/setup-node@v6
59+
with:
60+
node-version-file: website/.node-version
61+
cache: pnpm
62+
cache-dependency-path: website/pnpm-lock.yaml
63+
64+
- name: Set up pnpm
65+
uses: pnpm/action-setup@v4
66+
with:
67+
version: 10
68+
69+
- name: Install website dependencies
70+
run: pnpm --dir website install --frozen-lockfile
5871

59-
- name: Deploy documentation
72+
- name: Build website
6073
env:
61-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62-
run: |
63-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
64-
git config --global user.name "github-actions[bot]"
65-
uv run mkdocs gh-deploy --force
74+
SITE_URL: https://bub.build
75+
run: pnpm --dir website build
76+
77+
- name: Deploy website to Cloudflare Pages
78+
uses: cloudflare/wrangler-action@v3
79+
with:
80+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
81+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
82+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
83+
command: >-
84+
pages deploy website/dist
85+
--project-name=${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME }}
86+
--branch=main

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Core code lives under `src/`:
1212
- `src/bub/skills.py` / `src/bub/tools.py`: skill discovery and tool registry.
1313
- `src/skills/`: bundled skills shipped with Bub.
1414

15-
Tests live in `tests/`. Documentation lives in `docs/`.
15+
Tests live in `tests/`. The legacy MkDocs sources still live in `docs/`, while the new website and docs runtime lives in `website/`.
1616

1717
## Build, Test, and Development Commands
1818

@@ -27,7 +27,7 @@ Tests live in `tests/`. Documentation lives in `docs/`.
2727
- `uv run pytest -q`: run the main test suite.
2828
- `just test`: run pytest with doctests enabled.
2929
- `just check`: lock validation, lint, and typing.
30-
- `just docs` / `just docs-test`: serve or build docs.
30+
- `just docs` / `just docs-test`: serve or build the Astro website/docs in `website/`.
3131

3232
## Coding Style & Naming Conventions
3333

CONTRIBUTING.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,15 @@ git clone git@github.com:YOUR_NAME/bub.git
6262
cd bub
6363
```
6464

65-
Then, install and activate the environment with:
65+
Then, install the Python and website environments with:
6666

6767
```bash
68-
uv sync
68+
just install
6969
```
7070

71-
4. Install prek to run linters/formatters at commit time:
72-
73-
```bash
74-
uv run prek install
75-
```
71+
4. If you only need the Python environment, `uv sync` is still enough. The
72+
full `just install` path also installs the new website dependencies and
73+
sets up `prek`.
7674

7775
5. Create a branch for local development:
7876

@@ -96,7 +94,13 @@ Now, validate that all unit tests are passing:
9694
just test
9795
```
9896

99-
8. Before raising a pull request you should also run tox.
97+
9. If your change touches the website/docs experience, also build the Astro site:
98+
99+
```bash
100+
just docs-test
101+
```
102+
103+
10. Before raising a pull request you should also run tox.
100104
This will run the tests across different versions of Python:
101105

102106
```bash
@@ -106,15 +110,15 @@ tox
106110
This requires you to have multiple versions of python installed.
107111
This step is also triggered in the CI/CD pipeline, so you could also choose to skip this step locally.
108112

109-
10. Commit your changes and push your branch to GitHub:
113+
11. Commit your changes and push your branch to GitHub:
110114

111115
```bash
112116
git add .
113117
git commit -m "Your detailed description of your changes."
114118
git push origin name-of-your-bugfix-or-feature
115119
```
116120

117-
11. Submit a pull request through the GitHub website.
121+
12. Submit a pull request through the GitHub website.
118122

119123
# Pull Request Guidelines
120124

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,12 @@ Read more: [Context from Tape](https://tape.systems) · [Socialized Evaluation a
136136
## Development
137137

138138
```bash
139+
just install
139140
uv run ruff check .
140141
uv run mypy src
141142
uv run pytest -q
143+
just docs
144+
just docs-test
142145
```
143146

144147
See [CONTRIBUTING.md](https://github.com/bubbuild/bub/blob/main/CONTRIBUTING.md).

justfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ install:
77
#!/usr/bin/env bash
88
echo "🚀 Creating virtual environment using uv"
99
uv sync
10+
echo "🚀 Installing website dependencies with pnpm"
11+
pnpm --dir website install --frozen-lockfile
1012
uv run prek install
1113

1214
# Run code quality tools
@@ -55,9 +57,14 @@ build-and-publish: build publish
5557
# Test if documentation can be built without warnings or errors
5658
docs-test:
5759
#!/usr/bin/env bash
58-
uv run mkdocs build -s
60+
pnpm --dir website build
5961

6062
# Build and serve the documentation
6163
docs:
6264
#!/usr/bin/env bash
63-
uv run mkdocs serve
65+
pnpm --dir website dev --host
66+
67+
# Preview the production documentation build
68+
docs-preview:
69+
#!/usr/bin/env bash
70+
pnpm --dir website preview --host

website/.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.16.0

website/DEPLOYMENT.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Website Deployment
2+
3+
## Goal
4+
5+
The new `website/` directory is the docs and marketing site for Bub.
6+
7+
Legacy MkDocs source files may still exist in the repository during the
8+
transition, but production deployment now targets the Astro site on
9+
Cloudflare Pages.
10+
11+
## Cloudflare Pages
12+
13+
Connect the repository to a Cloudflare Pages project with Git integration.
14+
15+
Recommended settings:
16+
17+
- Production branch: `main`
18+
- Root directory: `website`
19+
- Build command: `pnpm install --frozen-lockfile && pnpm build`
20+
- Build output directory: `dist`
21+
- Environment variable: `SITE_URL=https://bub.build`
22+
- Environment variable: `NODE_VERSION=22.16.0`
23+
24+
The repo also includes [wrangler.jsonc](./wrangler.jsonc) so local preview and
25+
Cloudflare Pages runtime settings stay aligned:
26+
27+
- `pages_build_output_dir = "./dist"`
28+
- `compatibility_flags = ["nodejs_compat"]`
29+
30+
Production deployment is driven by GitHub release automation instead of
31+
push-based auto deploys.
32+
33+
## Current Repo State
34+
35+
The local developer entrypoints now target the new site:
36+
37+
- `just docs`
38+
- `just docs-test`
39+
- `just docs-preview`
40+
41+
The CI docs check also builds `website/` instead of MkDocs.
42+
43+
## GitHub Actions Deployment
44+
45+
The deployment split is intentionally simple:
46+
47+
- `main.yml` only verifies that the website builds
48+
- `on-release-main.yml` deploys production when a GitHub release is published
49+
50+
Required repository configuration:
51+
52+
- GitHub Actions secret: `CLOUDFLARE_API_TOKEN`
53+
- GitHub Actions secret: `CLOUDFLARE_ACCOUNT_ID`
54+
- GitHub Actions variable: `CLOUDFLARE_PAGES_PROJECT_NAME`
55+
56+
## Cutover Later
57+
58+
Once the Cloudflare Pages project is live and verified, the remaining cleanup
59+
work is:
60+
61+
1. remove legacy MkDocs source files once they are no longer needed
62+
2. update repository docs that still describe the old docs toolchain

website/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
"name": "website",
33
"type": "module",
44
"version": "0.0.1",
5+
"engines": {
6+
"node": ">=22.12.0"
7+
},
58
"scripts": {
69
"dev": "astro dev",
710
"build": "astro build",
8-
"preview": "astro preview"
11+
"preview": "wrangler pages dev ./dist"
912
},
1013
"dependencies": {
1114
"@astrojs/cloudflare": "^13.1.9",

website/wrangler.jsonc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "./node_modules/wrangler/config-schema.json",
3+
"name": "bub-website",
4+
"pages_build_output_dir": "./dist",
5+
"compatibility_date": "2026-04-15",
6+
"compatibility_flags": [
7+
"nodejs_compat"
8+
]
9+
}

0 commit comments

Comments
 (0)