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
70 changes: 70 additions & 0 deletions .github/workflows/deploy-cloudflare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
# Deploys the committed site in docs/ to Cloudflare (Workers static
# assets). docs/ is built locally with the ssg pinned in mise.toml; ci.yml
# checks that pin and that the output came from it.
# - pull request: validate the config with a dry run, no credentials.
# - push to a feat/** branch (or a manual run off main): deploy a
# preview to workers.dev only.
# - push to main: deploy production, serving alienstudio.com.
name: Deploy Cloudflare

on:
push:
branches: [main, "feat/**"]
pull_request:
branches: [main]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: cloudflare-${{ github.ref }}
cancel-in-progress: false

env:
WRANGLER_VERSION: "4.168.0"

jobs:
validate:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Dry run (preview and production)
run: |
npx --yes "wrangler@${WRANGLER_VERSION}" deploy --dry-run --env=""
npx --yes "wrangler@${WRANGLER_VERSION}" deploy --dry-run --env=production

deploy:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Deploy preview (workers.dev)
if: github.ref != 'refs/heads/main'
uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4.1.3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
wranglerVersion: ${{ env.WRANGLER_VERSION }}
command: deploy --env=""

- name: Deploy production
if: github.ref == 'refs/heads/main'
uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4.1.3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
wranglerVersion: ${{ env.WRANGLER_VERSION }}
command: deploy --env=production
37 changes: 0 additions & 37 deletions .github/workflows/deploy-pages.yml

This file was deleted.

27 changes: 24 additions & 3 deletions .github/workflows/quality-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
with:
node-version: "20"
node-version: "22"

- name: Install Audit Tooling
run: |
Expand All @@ -36,6 +38,16 @@ jobs:
node -e "JSON.parse(require('fs').readFileSync('config/ssg.json', 'utf8')); console.log('config/ssg.json is valid JSON');"
fi

- name: Setup Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.12"

- name: ssg pin is the latest release and built docs/
env:
GITHUB_TOKEN: ${{ github.token }}
run: python3 scripts/check-ssg-pin.py

- name: Canonical URLs, sitemap, hreflang and og:url
run: python3 scripts/check-seo.py docs https://alienstudio.com

Expand All @@ -45,3 +57,12 @@ jobs:
chmod +x scripts/prune-branches.sh
DRY_RUN=true bash scripts/prune-branches.sh origin
fi

- name: Accessibility (axe-core, rendered)
run: |
npm install --no-save puppeteer-core@23 axe-core@4
( cd docs && python3 -m http.server 8099 >/tmp/httpd.log 2>&1 & )
sleep 3
CHROME_PATH="$(command -v google-chrome || command -v google-chrome-stable || command -v chromium-browser || command -v chromium)"
echo "Using Chrome at: $CHROME_PATH"
CHROME_PATH="$CHROME_PATH" node scripts/a11y-axe.mjs http://localhost:8099 docs
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,8 @@ typings/
yarn-debug.log*
yarn-error.log*
yarn.lock

# Build output (docs/ holds the published copy)
public/
# Wrangler local state
.wrangler/
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
# Semantic Version: v0.0.2
# Semantic Version: v0.0.3
.PHONY: all build audit test contrast validate seo compress prune clean help

all: build
Expand All @@ -15,16 +15,18 @@ help:
@echo " make prune - Deterministically delete merged local/remote branches"
@echo " make clean - Remove build artifacts and temporary files"

# Build with the ssg pinned in mise.toml (mise install puts it on PATH)
# into public/ (not committed), then publish a fresh copy in docs/.
build:
@if command -v ssg >/dev/null 2>&1; then \
ssg build -f ssg.toml; \
elif [ -x "/Users/seb/Code/Public/Rust/static-site-generator/target/release/ssg" ]; then \
/Users/seb/Code/Public/Rust/static-site-generator/target/release/ssg build -f ssg.toml; \
elif [ -x "$$HOME/.cargo/bin/ssg" ]; then \
"$$HOME/.cargo/bin/ssg" build -f ssg.toml; \
else \
echo "SSG is not installed locally" >&2; exit 1; \
fi
@command -v ssg >/dev/null 2>&1 || { echo "ssg required: mise install (ssg is pinned in mise.toml)"; exit 1; }
@rm -rf public
@ssg build -f ssg.toml
@# docs/ is rebuilt from scratch so no stale fingerprinted file is served.
@rm -rf docs && mkdir docs && cp -R public/. docs/
@# ssg writes CNAME as a DNS zone line; keep the bare host.
@echo alienstudio.com > docs/CNAME
@# ssg's build caches and sidecars are not part of the site.
@rm -rf docs/.meta docs/.ssg docs/.ssg-cache docs/.ssg-plugin-cache.json

audit: contrast validate seo
@if pa11y-ci --version >/dev/null 2>&1; then \
Expand Down
33 changes: 24 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
</p>

<p align="center">
<a href="https://github.com/sebastienrousseau/alienstudio.github.io/actions"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/alienstudio.github.io/ci.yml?style=for-the-badge&logo=github" alt="Build" /></a>
<a href="https://github.com/sebastienrousseau/alienstudio.github.io/actions"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/alienstudio.github.io/quality-gate.yml?style=for-the-badge&logo=github" alt="Build" /></a>
<a href="https://github.com/sebastienrousseau/alienstudio.github.io/releases"><img src="https://img.shields.io/github/v/release/sebastienrousseau/alienstudio.github.io?style=for-the-badge&color=fc8d62&logo=git" alt="Release" /></a>
<a href="https://static-site-generator.com/"><img src="https://img.shields.io/badge/SSG-0.0.63-66c2a5?style=for-the-badge&labelColor=555555&logo=rust" alt="Built with SSG" /></a>
<a href="https://static-site-generator.com/"><img src="https://img.shields.io/badge/SSG-0.0.77-66c2a5?style=for-the-badge&labelColor=555555&logo=rust" alt="Built with SSG" /></a>
<a href="https://scorecard.dev/viewer/?uri=github.com/sebastienrousseau/alienstudio.github.io"><img src="https://img.shields.io/ossf-scorecard/github.com/sebastienrousseau/alienstudio.github.io?style=for-the-badge&label=OpenSSF%20Scorecard&logo=openssf" alt="OpenSSF Scorecard" /></a>
</p>

Expand All @@ -35,6 +35,7 @@
**Operational**

- [Development](#development) — make targets, quality gates, and automated testing
- [Deployment](#deployment) — Cloudflare Workers static assets
- [Security](#security) — Subresource Integrity (SRI) and Content Security Policy (CSP)
- [License](#license) — dual Apache-2.0 and MIT licensing

Expand All @@ -52,10 +53,11 @@

### Prerequisites

Ensure you have `ssg` installed via Cargo:
The ssg version is pinned in `mise.toml`. Install it with
[mise](https://mise.jdx.dev/):

```bash
cargo install ssg
mise install
```

### Local Build & Development
Expand All @@ -66,10 +68,7 @@ Clone the repository and compile the static assets:
git clone https://github.com/sebastienrousseau/alienstudio.github.io.git
cd alienstudio.github.io

# Compile with Static Site Generator (SSG)
ssg build -f ssg.toml

# Or use the repository build target
# Build into public/ and publish a fresh copy in docs/
make build

# Preview the compiled site
Expand Down Expand Up @@ -111,7 +110,7 @@ The generated site is checked with SSG's 10-pillar quality gate, axe across desk
Run automated regression tests and the 10-pillar quality audit:

```bash
# Compile through the locally installed SSG
# Build with the ssg pinned in mise.toml
make build

# Run contrast, frontmatter, and regression gates
Expand All @@ -120,6 +119,22 @@ make audit

---

## Deployment

The committed site in `docs/` is served from Cloudflare Workers static
assets (`wrangler.jsonc`, `.github/workflows/deploy-cloudflare.yml`):

- a pull request dry-runs the deploy, with no credentials;
- a push to a `feat/**` branch deploys a preview to workers.dev;
- a push to `main` deploys production at alienstudio.com.

`worker/notFound.js` answers unknown paths with the 404 page and a 404
status, and `docs/_headers` (written by ssg) adds the security headers.
CI fails when the ssg pin is not the latest release or did not build
`docs/` (`scripts/check-ssg-pin.py`), and runs axe-core on every page.

---

## Security

Every deployment adheres to strict security and integrity standards:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.2
0.0.3
85 changes: 0 additions & 85 deletions docs/.meta/404.meta.json

This file was deleted.

Loading