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
33 changes: 32 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,44 @@ jobs:
echo "ok=true" >> "$GITHUB_OUTPUT"
fi

# Stage only the site into _site/. The repo root also holds CI config,
# scripts, and Markdown, and deploying `.` published all of them at
# capondargan.com (README.md, scripts/*.sh, .github/**).
- name: Stage site files
if: steps.gate.outputs.ok == 'true'
run: >
rsync -a
--exclude='.git'
--exclude='.github/'
--exclude='.gitignore'
--exclude='.nvmrc'
--exclude='scripts/'
--exclude='*.md'
--exclude='_site/'
./ _site/

# Fails in both directions: an internal path that was staged, or a file
# the site needs that the excludes dropped.
- name: Verify the staged site
if: steps.gate.outputs.ok == 'true'
run: |
leaked=$(find _site \( -name '*.md' -o -path '_site/.github*' -o -path '_site/scripts*' -o -name '.gitignore' -o -name '.nvmrc' \) -print)
if [ -n "$leaked" ]; then
echo "Internal paths were staged:"
echo "$leaked"
exit 1
fi
for f in index.html 404.html _headers _redirects robots.txt .well-known/security.txt; do
[ -f "_site/$f" ] || { echo "Missing from _site/: $f"; exit 1; }
done

- name: Deploy to Cloudflare Pages
if: steps.gate.outputs.ok == 'true'
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID || '8a0d49b1f3fdcdadec135562ec8a4fdc' }}
run: >
npx wrangler@4 pages deploy .
npx wrangler@4 pages deploy _site
--project-name capondargan-com
--branch ${{ github.ref == 'refs/heads/main' && 'main' || github.head_ref }}
--commit-dirty=false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.wrangler/
.dev.vars*
.env*
_site/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ Deploy is a separate workflow (`.github/workflows/deploy.yml`). CI does not depl

## Deploy

One repo → one Cloudflare Pages project (`capondargan-com`, TechGuyWithABeard account), deployed by **GitHub Actions** with `wrangler pages deploy`. Framework preset **None**. No build step: the repo is the output. Cloudflare's Pages Git integration is off. There is no other deploy path.
One repo → one Cloudflare Pages project (`capondargan-com`, TechGuyWithABeard account), deployed by **GitHub Actions** with `wrangler pages deploy`. Framework preset **None**. No build step: the repo, minus its internals, is the output. Cloudflare's Pages Git integration is off. There is no other deploy path.

1. Open a draft pull request
2. CI (`ci` job) must pass
3. Merge to `main`
4. The deploy workflow uploads the repo root to Pages
4. The deploy workflow stages the site into `_site/`, leaving out `.github/`, `scripts/`, and Markdown, and uploads that to Pages

## Mail

Expand Down
Loading