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
28 changes: 9 additions & 19 deletions .github/workflows/pages.yml → .github/workflows/site.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and deploy the Captua site with Hugo
name: Build the Captua site with Hugo and deploy it to Cloudflare

on:
push:
Expand All @@ -10,7 +10,7 @@ permissions:
contents: read

concurrency:
group: pages-${{ github.ref }}
group: site-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
Expand All @@ -28,21 +28,11 @@ jobs:
- run: npm ci
- run: npm run build
- run: npm test
- uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
- name: Deploy to Cloudflare
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4.1.3
with:
path: public

deploy:
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
wranglerVersion: '4.152.0'
command: deploy
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ npm test

The production build writes `public/` and builds the search index. `npm test` checks the built site: internal links and fragments resolve, every image exists and has alt text, every page has one title and one H1 and is not empty, canonical addresses and the robots policy match the build, no URL carries a token or other credential, both language search indexes are present, the sitemap index covers both languages, and every English page with a `translationKey` has a Spanish page or is listed in `data/translations_pending.json`. Results are written to the ignored `reports/` directory.

The Pages workflow in `.github/workflows/pages.yml` builds and tests every pull request. It runs the deployment job only for `main`, after the checks pass, and that job publishes `public/`. `static/CNAME` sets the custom domain.
The workflow in `.github/workflows/site.yml` builds and tests every pull request. On a push to `main`, after the checks pass, it deploys `public/` to Cloudflare Workers as static assets with Wrangler, using `wrangler.jsonc`, which also sets the custom domain `captua.org`. The deploy reads two repository secrets, `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID`.
8 changes: 7 additions & 1 deletion scripts/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,13 @@ def route_of(file):
for entry in json.loads((ROOT / 'migration/sources.json').read_text())['pages']:
check(entry['url'] in routes, f"Expected page not built: {entry['url']}")
check(entry.get('translationKey') not in drafts, f"Expected page is a draft: {entry['url']}")
check((PUBLIC / 'CNAME').exists() and (PUBLIC / 'CNAME').read_text().strip() == 'captua.org', 'CNAME missing or wrong')
# Deployment: wrangler.jsonc serves public/ and binds the custom domain captua.org.
try:
wr = json.loads('\n'.join(l for l in (ROOT / 'wrangler.jsonc').read_text().splitlines() if not l.lstrip().startswith('//')))
check(wr.get('assets', {}).get('directory') == './public', 'wrangler.jsonc does not serve ./public')
check({'pattern': 'captua.org', 'custom_domain': True} in wr.get('routes', []), 'wrangler.jsonc lacks the captua.org custom domain')
except (OSError, ValueError) as e:
check(False, f'wrangler.jsonc unreadable: {e}')
check(('Disallow: /' in (PUBLIC / 'robots.txt').read_text()) == preview, 'Wrong robots policy')

out = {'checks': checks, 'failures': len(errors), 'preview': preview, 'pages': len(pages),
Expand Down
1 change: 0 additions & 1 deletion static/CNAME

This file was deleted.

13 changes: 13 additions & 0 deletions wrangler.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Serves the built site (public/) as static assets on Cloudflare Workers.
// The GitHub Actions workflow deploys it from main; see README.md.
{
"name": "captua-docs",
"compatibility_date": "2026-11-08",
"assets": {
"directory": "./public",
"not_found_handling": "404-page"
},
"routes": [
{ "pattern": "captua.org", "custom_domain": true }
]
}
Loading