.github/workflows/ covering continuous integration, automated releases, static site deployment, and branch policy enforcement.
Workflow overview
ci.yml
Runs unit tests and Lighthouse CI on every PR targeting
preview. Required to pass before merge.release.yml
Runs semantic-release on every push to
main. Creates version tags, CHANGELOG entries, and GitHub Releases.deploy-storybook.yml
Deploys Storybook to GitHub Pages on pushes to
main that touch component files. Also manually triggerable.sync-preview.yml
Merges
main back into preview after every successful release. Sends a Discord notification on success or failure.enforce-preview-branch.yml
Blocks PRs into
main from any branch other than preview.enforce-preview-source.yml
Blocks manual PRs from
main into preview — that direction is handled automatically by sync-preview.yml.ci.yml — Continuous Integration
Trigger: Pull requests targeting thepreview branch.
Jobs
unit-tests — Runs the full Vitest suite:
lighthouse — Builds the Astro site and runs Lighthouse CI:
Lighthouse CI runs with
continue-on-error: true so that a Lighthouse regression does not block an otherwise-passing PR. The results still appear as a status check in the PR. Install the LHCI GitHub App and set LHCI_GITHUB_APP_TOKEN to get inline performance annotations on the PR.Required GitHub variables
The Lighthouse build job reads these from the repository’s Variables (not secrets):| Variable | Example |
|---|---|
PUBLIC_SANITY_STUDIO_PROJECT_ID | 49nk9b0w |
PUBLIC_SANITY_STUDIO_DATASET | production |
PUBLIC_SITE_URL | https://ywcc-capstone.pages.dev |
PUBLIC_GTM_ID | GTM container ID |
release.yml — Semantic Release
Trigger: Pushes tomain.
fetch-depth: 0 is required so semantic-release can read the full git history to determine the version bump from commit messages.
RELEASE_TOKEN must be a Personal Access Token (not the default GITHUB_TOKEN) because semantic-release pushes a commit back to main (the changelog commit), and push-to-protected-branch requires a PAT.
deploy-storybook.yml — Storybook Deploy
Trigger: Pushes tomain touching astro-app/src/**, astro-app/.storybook/**, or astro-app/package.json. Also manually triggerable via workflow_dispatch.
See Deploying Sanity Studio for the full workflow source and configuration details.
sync-preview.yml — Preview Sync
Trigger: Runs automatically after every successfulRelease workflow completes.
Preview branch synced
preview is now in sync with main at abc1234.
Safe to pull and branch from preview.
If the merge fails (e.g., due to a conflict), a failure embed is posted with a link to the Actions run.
enforce-preview-branch.yml — Main Branch Guard
Trigger: Pull requests targetingmain.
preview. It enforces the git workflow rule that main only accepts merges from preview.
enforce-preview-source.yml — Preview Branch Guard
Trigger: Pull requests targetingpreview.
main → preview. The sync-preview.yml workflow handles this direction automatically after every release, so manual PRs from main are unnecessary and potentially disruptive.
Secrets and variables reference
| Name | Type | Used by |
|---|---|---|
RELEASE_TOKEN | Secret (PAT) | release.yml, sync-preview.yml |
LHCI_GITHUB_APP_TOKEN | Secret | ci.yml (optional) |
DISCORD_WEBHOOK_URL | Secret | sync-preview.yml |
CLOUDFLARE_API_TOKEN | Secret | Manual deploy scripts |
CLOUDFLARE_ACCOUNT_ID | Secret | Manual deploy scripts |
SANITY_API_READ_TOKEN | Secret | ci.yml Lighthouse build |
PUBLIC_SANITY_STUDIO_PROJECT_ID | Variable | ci.yml Lighthouse build |
PUBLIC_SANITY_STUDIO_DATASET | Variable | ci.yml Lighthouse build |
PUBLIC_SITE_URL | Variable | ci.yml Lighthouse build |
PUBLIC_GTM_ID | Variable | ci.yml Lighthouse build |