diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..cf02e46 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,42 @@ +name: Pages + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@1.97.1 + - uses: actions/configure-pages@v5 + - name: Export static site + run: cargo run --locked -p coldfront-static -- dist + env: + CLERK_PUBLISHABLE_KEY: ${{ vars.CLERK_PUBLISHABLE_KEY }} + - uses: actions/upload-pages-artifact@v4 + with: + path: dist + + deploy: + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index c42d8c6..bae466f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /target +/dist /.tools .DS_Store .env diff --git a/Cargo.lock b/Cargo.lock index 8df6559..f44637a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -215,6 +215,15 @@ dependencies = [ "topcoat", ] +[[package]] +name = "coldfront-static" +version = "0.1.0" +dependencies = [ + "coldfront-ui", + "tokio", + "topcoat", +] + [[package]] name = "coldfront-ui" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 1ff227c..38ce652 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ members = [ "apps/coldfront", "crates/coldfront-ui", "tools/coldfront-coatcheck", + "tools/coldfront-static", ] [workspace.package] diff --git a/README.md b/README.md index 6a0fcff..e890bbd 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,26 @@ Topcoat rebuilds and reloads each server when Rust or component files change. ./scripts/check ``` +## Export for GitHub Pages + +Cold Front can be built as a static site without running the Topcoat server: + +```sh +./scripts/export-pages +python3 -m http.server 8000 --directory dist +``` + +Open to inspect the same production components that +will be published. The export writes relative asset links, so it works from a +GitHub Pages project path such as `https://superposition.github.io/coldfront/`. +Generated files stay in the ignored `dist/` directory. + +The [`Pages` workflow](.github/workflows/pages.yml) exports and deploys the site +after changes reach `main`. In the repository's **Settings → Pages** screen, +select **GitHub Actions** as the source once. Authentication is optional; add a +repository Actions variable named `CLERK_PUBLISHABLE_KEY` only when the Clerk +application accepts the GitHub Pages domain. + The initial component glossary is in [`docs/COMPONENTS.md`](docs/COMPONENTS.md), and the proposed product/design sequence is in [`docs/PLAN.md`](docs/PLAN.md). The Storybook-to-Coatcheck diff --git a/crates/coldfront-ui/src/organisms.rs b/crates/coldfront-ui/src/organisms.rs index 0a2bcf2..aa64f4c 100644 --- a/crates/coldfront-ui/src/organisms.rs +++ b/crates/coldfront-ui/src/organisms.rs @@ -12,7 +12,7 @@ use crate::{ pub async fn command_header() -> Result { view! {
- wordmark() + wordmark()