This repository uses an automated promotion and release flow.
Use this branch sequence for each change:
- Create a feature branch from
pre-release. - Open a pull request from the feature branch to
pre-release. - Merge the pull request after the required checks pass.
- Open one promotion pull request from
pre-releasetomain. - Merge the promotion pull request after all checks pass.
The branch-flow check rejects other pull requests to main.
Each pull request to pre-release or main runs these checks:
qualityruns the audit, format check, lint check, build, unit tests, coverage, and package checks.browserruns Playwright tests against the local demo and the static Cloudflare export.
A promotion pull request to main also runs the integration check. This check runs all SDK and publishing integration tests in Docker.
After a merge to main, the CI workflow runs again. A successful run starts the deployment and release workflows.
The demo deployment workflow performs these actions:
- Build all packages.
- Make sure that the configured Cloudflare zone is active.
- Deploy the demo API Worker to
api.demo.cortexdocs.dev. - Deploy the logo to
static.cortexdocs.devwith Cloudflare Static Assets and record each distinct referrer hostname in D1. - Build the complete docs UI as static files.
- Deploy the static files to
demo.cortexdocs.dev. - Make sure that Cloudflare Static Assets serves each demo page.
- Block unknown paths before they invoke the demo API Worker.
- Limit valid demo API requests to 30 requests for each IP address during 10 seconds.
Requests to the demo site do not use the daily Workers request allowance. Badge image requests
invoke a small Worker so it can store new referrer hostnames. Try now requests invoke the demo
API Worker.
The release workflow performs these actions:
- Read the current CLI version and the latest npm version.
- Increase the patch number in the
x.x.xversion. - Set the version in the CLI and product docs workspace manifests.
- Run
copilot -pto create the release notes. - Update
CHANGELOG.mdwith the release notes. - Commit the version and changelog changes to
main. - Create the matching
vX.X.Xtag. - Publish only
@cortex-docs/clifrom the workspaces. - Generate
@cortex-docs/mcpfrom the product documentation. - Publish
@cortex-docs/mcpwith the same release version. - Build the complete product documentation as static files.
- Deploy the static files to
docs.cortexdocs.dev. - Make sure that Cloudflare Static Assets serves the product documentation.
- Create the GitHub Release with the generated changelog notes.
The release stops before the product docs deployment if an npm publication fails. A rerun skips package versions that already exist.
The workflow creates or updates the GitHub Release after all package and documentation checks pass. This operation is safe during a workflow rerun.
The CLI tarball includes the internal workspace packages that it uses. The release does not publish these workspaces as separate npm packages.
The release notes always contain these sections:
- New Features
- Bug Fixes
- Improvements
Add these GitHub Actions repository secrets:
CLOUDFLARE_ACCOUNT_IDCLOUDFLARE_API_TOKENCLOUDFLARE_ZONE_IDNPM_TOKENPERSONAL_ACCESS_TOKEN
Give CLOUDFLARE_API_TOKEN permission to edit Workers and zone WAF rules. Give the token permission to read the zone.
Create a protected GitHub environment named npm. Permit the release workflow to use this environment.
Create PERSONAL_ACCESS_TOKEN from a user account that has a Copilot subscription. Give the token the Copilot Requests account permission.
The release workflow provides this secret to Copilot CLI as COPILOT_GITHUB_TOKEN.
Protect pre-release with these required checks:
branch-flowqualitybrowser
Protect main with these required checks:
branch-flowqualitybrowserintegration
Allow the release workflow to push its version commit and tag to main.
Run this command to calculate the next version without file changes:
node scripts/set-release-version.mjs --checkRun this command to build the demo for the Cloudflare runtime:
npm run --workspace=@cortex-docs/docs-ui demo:buildRun this command to build the product docs for the Cloudflare runtime:
npm run --workspace=@cortex-docs/docs-ui docs:buildRun this command to generate, build, and pack the product docs MCP package:
node scripts/publish-docs-mcp.mjs 0.0.0 --dry-runRun this command to preview the Cloudflare build:
npm run --workspace=@cortex-docs/docs-ui demo:previewRun this command to preview the product docs build:
npm run --workspace=@cortex-docs/docs-ui docs:previewRun this command to list the hostnames that have loaded the Built with Cortex badge:
npx wrangler d1 execute cortex-badge-referrers --remote \
--command="SELECT hostname, first_seen_at FROM badge_referrer_hosts ORDER BY first_seen_at DESC"