Repository navigation
ci: deploy the marketing and docs sites to Cloudflare Workers #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| name: Deploy sites | ||
|
|
||
| # Publishes the marketing site to code-zero.dev and the docs to docs.code-zero.dev, as two static | ||
| # Cloudflare Workers (see each app's `wrangler.jsonc`). Both are generated ahead of time, so a | ||
| # deploy is a build plus an asset upload; nothing runs on Cloudflare at request time. | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - apps/marketing/** | ||
| - apps/docs/** | ||
| - docs/*.md | ||
| - packages/build-env/** | ||
| - packages/i18n/** | ||
| - packages/ui/** | ||
| # Shared build inputs: a change to any of them changes what the sites are built from. | ||
| - scripts/tsdown.config.ts | ||
| - package.json | ||
| - pnpm-lock.yaml | ||
| - pnpm-workspace.yaml | ||
| - turbo.jsonc | ||
| - .github/actions/setup-toolchain/** | ||
| - .github/workflows/deploy-sites.yml | ||
| workflow_dispatch: | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| # One deploy per site at a time, and never cancel one halfway through an upload. | ||
| group: ${{ github.workflow }} | ||
| cancel-in-progress: false | ||
|
|
||
| env: | ||
| # Pinned so a deploy is reproducible; bump together with the compatibility dates in wrangler.jsonc. | ||
| WRANGLER_VERSION: 4.151.1 | ||
|
|
||
| jobs: | ||
| deploy: | ||
| name: Deploy ${{ matrix.site }} | ||
| if: github.repository == 'wolfstar-project/code-zero' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| permissions: | ||
| contents: read | ||
| environment: | ||
| name: ${{ matrix.site }} | ||
| url: ${{ matrix.url }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - site: marketing | ||
| package: '@code-zero/marketing' | ||
| url: https://code-zero.dev | ||
| - site: docs | ||
| package: '@code-zero/docs' | ||
| url: https://docs.code-zero.dev | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup toolchain | ||
| uses: ./.github/actions/setup-toolchain | ||
|
|
||
| - name: Build workspace dependencies | ||
| env: | ||
| PACKAGE: ${{ matrix.package }} | ||
| run: aube exec turbo run build --filter="${PACKAGE}^..." | ||
|
|
||
| - name: Generate static site | ||
| working-directory: apps/${{ matrix.site }} | ||
| env: | ||
| # Absolute URLs in the sitemap, canonical links and robots.txt. | ||
| NUXT_SITE_URL: ${{ matrix.url }} | ||
| MARKETING_SITE_URL: https://code-zero.dev | ||
| MARKETING_DASHBOARD_URL: https://app.code-zero.dev | ||
| CODE_ZERO_BUILD_COMMIT: ${{ github.sha }} | ||
| CODE_ZERO_BUILD_BRANCH: ${{ github.ref_name }} | ||
| # The Docus prerender needs more than Node's default heap. | ||
| NODE_OPTIONS: --max-old-space-size=6144 | ||
| run: aube exec nuxt generate | ||
|
|
||
| - name: Deploy to Cloudflare | ||
| working-directory: apps/${{ matrix.site }} | ||
| env: | ||
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
| CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }} | ||
| run: npx --yes "wrangler@${WRANGLER_VERSION}" deploy | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| // Docus is generated as a static site (`nuxt generate`): every page is prerendered and search | ||
| // runs in the browser over the content dump, so the Worker only serves files and needs no D1. | ||
| "name": "code-zero-docs", | ||
| "compatibility_date": "2026-10-01", | ||
| "assets": { | ||
| "directory": ".output/public", | ||
| "not_found_handling": "404-page", | ||
| "html_handling": "drop-trailing-slash", | ||
| }, | ||
| "routes": [{ "pattern": "docs.code-zero.dev", "custom_domain": true }], | ||
| "workers_dev": true, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| // The marketing site is prerendered end to end (`nuxt generate`) and has no server routes, so the | ||
| // Worker only serves the generated files: no script, no bindings, nothing to keep warm. | ||
| "name": "code-zero-marketing", | ||
| "compatibility_date": "2026-10-01", | ||
| "assets": { | ||
| "directory": ".output/public", | ||
| // `nuxt generate` writes `404.html`; serve it with a 404 status for unknown paths. | ||
| "not_found_handling": "404-page", | ||
| "html_handling": "drop-trailing-slash", | ||
| }, | ||
| "routes": [{ "pattern": "code-zero.dev", "custom_domain": true }], | ||
| "workers_dev": true, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.