Skip to content

Commit 9f61743

Browse files
committed
docs: add demo docs and CI deploy
1 parent 59004ee commit 9f61743

5 files changed

Lines changed: 450 additions & 346 deletions

File tree

.github/workflows/deploy-demo.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Deploy Demo (Deno Deploy)
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
ref:
9+
description: "Git ref to deploy (branch, tag, or SHA)"
10+
required: false
11+
default: "main"
12+
type: string
13+
14+
permissions:
15+
contents: read
16+
17+
concurrency:
18+
group: deploy-demo
19+
cancel-in-progress: false
20+
21+
jobs:
22+
deploy:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
ref: ${{ github.event.release.tag_name || inputs.ref }}
29+
30+
- name: Setup Deno
31+
uses: denoland/setup-deno@v2
32+
with:
33+
deno-version: v2.x
34+
35+
- name: Verify formatting
36+
run: deno fmt --check
37+
38+
- name: Lint
39+
run: deno lint
40+
41+
- name: Tests
42+
run: deno task test
43+
44+
- name: Deploy
45+
env:
46+
DENO_DEPLOY_TOKEN: ${{ secrets.DENO_DEPLOY_TOKEN }}
47+
run: deno deploy --config docs/deno.json --prod docs

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ Based on the
2222
["Kind of Like That"](https://www.hackerfactor.com/blog/?/archives/529-Kind-of-Like-That.html)
2323
article by [Dr. Neal Krawetz](https://www.hackerfactor.com/about.php).
2424

25+
## Demo
26+
27+
Live demo (Deno Deploy): https://dhash.claudiuceia.deno.net/
28+
29+
The demo source lives in `docs/` (`docs/main.tsx`, `docs/client.js`) and is
30+
deployed separately from the JSR package.
31+
2532
## Usage
2633

2734
You can compare dhash values by simply computing the Hamming distance between

docs/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# dHash Demo (Deno Deploy)
2+
3+
This folder contains a small, deployable demo app for the `@claudiu-ceia/dhash`
4+
library.
5+
6+
- Production demo: `https://dhash.claudiuceia.deno.net/`
7+
- Deno Deploy config: `docs/deno.json`
8+
- Server: `docs/main.tsx` (SSR HTML + `/hash` API)
9+
- Client: `docs/client.js` (upload UI, hashing, sorting)
10+
11+
## What It Does
12+
13+
1. Upload up to 20 images (max 10MB each).
14+
2. Computes a 64-bit dHash for each image by calling `POST /hash`.
15+
3. Sorts images by similarity (Hamming distance) to a reference image you set by
16+
clicking a card.
17+
18+
Everything is in-memory; no persistence.
19+
20+
## Run Locally
21+
22+
From the repo root:
23+
24+
```bash
25+
deno run -A --config docs/deno.json docs/main.ts
26+
```
27+
28+
Then open `http://localhost:8000/`.
29+
30+
## Deploy
31+
32+
This app is intended to be deployed from CI using `deno deploy` and the
33+
`DENO_DEPLOY_TOKEN` secret. See `.github/workflows/deploy-demo.yml`.

0 commit comments

Comments
 (0)