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
51 changes: 0 additions & 51 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,54 +86,3 @@ jobs:

- name: Run Playwright tests
run: npm test

deploy-netlify:
runs-on: ubuntu-latest
needs: [ compile, browser-test, playwright-test ]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
environment:
name: netlify
url: https://go-wasmsqlite-demo.netlify.app
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Build Example
run: make build-example

- name: Verify Netlify headers
run: |
test -f example/_headers
grep -q "Cross-Origin-Opener-Policy: same-origin" example/_headers
grep -q "Cross-Origin-Embedder-Policy: require-corp" example/_headers

- name: Deploy to Netlify
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: |
if [ -z "$NETLIFY_AUTH_TOKEN" ]; then
echo "::error::NETLIFY_AUTH_TOKEN secret is required"
exit 1
fi
if [ -z "$NETLIFY_SITE_ID" ]; then
echo "::error::NETLIFY_SITE_ID secret is required"
exit 1
fi

npx --yes netlify-cli@26.0.2 deploy \
--dir example \
--prod \
--no-build \
--site "$NETLIFY_SITE_ID" \
--message "GitHub Actions deploy ${GITHUB_SHA}"
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,29 @@ The Pages workflow runs `make build-example` and publishes `./example`. The publ

`enable-threads.js` is loaded before the Go WASM app. On static hosts without COOP/COEP response headers, it registers a service worker, reloads the page, and makes the page cross-origin isolated so OPFS can work.

## Netlify
## Deployment

The CI workflow deploys `./example` to `go-wasmsqlite-demo` after compile, browser, and Playwright jobs pass on `main`. Netlify applies `example/_headers` to static assets, so the deployed demo receives real COOP/COEP/CORP headers instead of relying on the service-worker header shim.
The public demo is intended to be served from `https://lightning.community/go-wasmsqlite/`.

Repository secrets required for deployment:
The host in front of the built `./example` directory must set the OPFS headers
on every response:

- `NETLIFY_AUTH_TOKEN`: Netlify personal access token with deploy access to the site.
- `NETLIFY_SITE_ID`: Netlify site id for the demo site.
```text
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Resource-Policy: same-origin
```

It must also serve `*.wasm` as `application/wasm`. The repository keeps
`example/_headers` for static hosts that understand that file format, but
GitHub Pages does not apply `_headers`; the `lightning.community` route should
therefore terminate on a header-capable edge/proxy or the reusable Lightning
Labs WASM static server.
Comment on lines +398 to +402

If the route is proxied through Cloudflare, avoid TLS/proxy settings that make
the origin redirect back to the same HTTPS URL. A same-location `301` on
`/go-wasmsqlite/` happens before the app loads, so it cannot be fixed by the
service-worker header shim.

## Limitations

Expand Down
Loading