Skip to content

Commit bb28deb

Browse files
ci(website): version the site through changesets, deploy to Cloudflare Workers (#828)
* ci(website): version the site through changesets website/site joins the pnpm workspace as nostream-website, so the marketing site is versioned by the same changesets flow as the relay. Its standalone lockfile folds into the root one. Verified: changeset version bumps nostream-website only (nostream stays at its own version), site builds from the merged lockfile. * ci(website): deploy the static site to Cloudflare Workers wrangler.jsonc binds the built dist/ as a Workers static-assets site (html_handling auto-trailing-slash, SPA fallback for unknown paths — the site has no 404 page and no server code; everything is prerendered). wrangler joins website/site as a devDependency. Deploy Website runs after a release PR merges to main (paths cover the site, its lockfile and every repo file the build reads at build time: README, docs, deploy runbooks, CHANGELOG, package.json), plus workflow_dispatch. It builds with SITE_URL from the website-production environment and runs wrangler deploy with CLOUDFLARE_API_TOKEN from that environment. ema.tnsor.network rides on a Workers Custom Domain — set it on the worker at first deploy. Dry-run verified: wrangler reads the 96 built files, 0.37 KiB worker. * ci: teach knip the website workspace The workspace merge made knip scan website/site, where it cannot trace Astro's build-time imports (astro, sharp, the CSS-imported @fontsource packages) or wrangler (invoked by CI, not imported), so all five read as unused dependencies and check:deps failed. Each gets an explicit ignoreDependencies row in the website/site workspace block, scoped to that workspace only. * ci(website): point the deploy at the website environment Cameri provisioned the environment under the name 'website' with CLOUDFLARE_API_TOKEN (secret) and CLOUDFLARE_ACCOUNT_ID (var), so the job references that environment directly. SITE_URL is pinned to https://ema.tnsor.network — the site is built for one production domain, no need for a configurable var. * ci: apply Greptile review fixes to the website deploy - workflow_dispatch on deploy-website.yml ignores the push-branch filter; the job now refuses to run off main - website releases (nostream-website@ tags) no longer build the relay container image: release.yml gates on the relay's vX.Y.Z tag shape - pnpm.onlyBuiltDependencies moves from website/site/package.json to pnpm-workspace.yaml, where pnpm 10 reads it; esbuild postinstalls run again instead of being silently skipped
1 parent 7409006 commit bb28deb

9 files changed

Lines changed: 7473 additions & 6841 deletions

File tree

‎.changeset/site-initial-version.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"nostream-website": minor
3+
---
4+
5+
feat(website): version and deploy the marketing site
6+
7+
`website/site` joins the pnpm workspace as `nostream-website`, so the marketing site is versioned and released through the same changesets flow as the relay. The site builds as a static bundle (docs and changelog render from the repository at build time — no SSR) and deploys to Cloudflare Workers with static assets at ema.tnsor.network through CI.
8+
9+
The deploy is a Cloudflare Worker with static assets (`website/site/wrangler.jsonc`), built and shipped by the new `Deploy Website` workflow after a release PR merges to `main`.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Deploy Website
2+
3+
# The marketing site deploys after a release lands on main: the changesets
4+
# release PR bumps nostream-website, merging it is the deploy trigger. Version
5+
# the site with a changeset, merge the release PR — never deploy from a branch.
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- "website/site/**"
13+
- "pnpm-lock.yaml"
14+
- "package.json"
15+
- "README.md"
16+
- "CLI.md"
17+
- "CONFIGURATION.md"
18+
- "CONTRIBUTING.md"
19+
- "SECURITY.md"
20+
- "CHANGELOG.md"
21+
- "deploy/**"
22+
- "docs/**"
23+
workflow_dispatch:
24+
25+
concurrency:
26+
group: deploy-website
27+
cancel-in-progress: false
28+
29+
jobs:
30+
deploy:
31+
# workflow_dispatch ignores the push-branch filter; a manual run must not
32+
# publish a non-main branch to production.
33+
if: github.event_name != 'workflow_dispatch' || github.ref == 'refs/heads/main'
34+
name: Build and deploy to Cloudflare Workers
35+
runs-on: ubuntu-latest
36+
# Deploy credentials live in this GitHub environment: CLOUDFLARE_API_TOKEN
37+
# secret (Workers Scripts scope) and CLOUDFLARE_ACCOUNT_ID variable.
38+
environment: website
39+
permissions:
40+
contents: read
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v3
44+
45+
- uses: pnpm/action-setup@v4
46+
47+
- uses: actions/setup-node@v3
48+
with:
49+
node-version-file: .nvmrc
50+
cache: pnpm
51+
52+
- name: Install workspace dependencies
53+
run: pnpm install --frozen-lockfile
54+
55+
- name: Build the site
56+
working-directory: website/site
57+
env:
58+
SITE_URL: https://ema.tnsor.network
59+
run: pnpm run build
60+
61+
- name: Deploy to Cloudflare Workers
62+
working-directory: website/site
63+
env:
64+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
65+
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
66+
run: pnpm exec wrangler deploy

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66

77
jobs:
88
build-and-push-image:
9+
# Changesets tags each workspace package on publish: relay releases tag
10+
# vX.Y.Z, website releases tag nostream-website@X.Y.Z. Only a relay tag
11+
# should build the relay container image.
12+
if: startsWith(github.event.release.tag_name, 'v')
913
name: Build and push container image
1014
runs-on: ubuntu-latest
1115
env:

‎.knip.json‎

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,46 @@
11
{
2-
"$schema": "https://unpkg.com/knip@2/schema.json",
3-
"entry": [
4-
"src/index.ts!",
5-
"src/import-events.ts!",
6-
"src/cli/index.ts!",
7-
"src/scripts/benchmark-queries.ts!",
8-
"knexfile.js!"
9-
],
10-
"project": [
11-
"src/**/*.ts!"
12-
],
13-
"ignoreDependencies": [
14-
"lzma-native"
15-
],
16-
"ignore": [
17-
".nostr/**",
18-
"src/utils/relay-probe/**"
19-
],
20-
"commitlint": false,
21-
"eslint": false,
22-
"github-actions": false,
23-
"husky": false,
24-
"mocha": false,
25-
"nyc": false,
26-
"semantic-release": false
2+
"$schema": "https://unpkg.com/knip@2/schema.json",
3+
"workspaces": {
4+
".": {
5+
"entry": [
6+
"src/index.ts!",
7+
"src/import-events.ts!",
8+
"src/cli/index.ts!",
9+
"src/scripts/benchmark-queries.ts!",
10+
"knexfile.js!"
11+
],
12+
"project": [
13+
"src/**/*.ts!"
14+
],
15+
"ignoreDependencies": [
16+
"lzma-native"
17+
],
18+
"ignore": [
19+
".nostr/**",
20+
"src/utils/relay-probe/**"
21+
],
22+
"commitlint": false,
23+
"eslint": false,
24+
"github-actions": false,
25+
"husky": false,
26+
"mocha": false,
27+
"nyc": false,
28+
"semantic-release": false
29+
},
30+
"website/site": {
31+
"entry": [
32+
"astro.config.mjs",
33+
"src/**/*.{astro,ts,mjs}",
34+
"scripts/*.mjs"
35+
],
36+
"ignoreDependencies": [
37+
"@fontsource-variable/inter",
38+
"@fontsource/jetbrains-mono",
39+
"astro",
40+
"sharp",
41+
"wrangler"
42+
],
43+
"astro": true
44+
}
45+
}
2746
}

0 commit comments

Comments
 (0)