cloud-deploy-gcp-aws
Use when a web/frontend app needs a cloud deploy - GitHub Actions to Cloud Run/ECS for SSR or GCS+CDN/Firebase and S3+CloudFront for static, with build-time env and cache invalidation
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-15
- Stars
- ★ 122
- Forks
- 18
01 前言 Front Matter
- name
- cloud-deploy-gcp-aws
- category
- deployment
- description
- Use when a web/frontend app needs a cloud deploy - GitHub Actions to Cloud Run/ECS for SSR or GCS+CDN/Firebase and S3+CloudFront for static, with build-time env and cache invalidation
03 SKILL.md 正文
Cloud Deploy — GCP & AWS (web)
Overview
A web deploy's shape follows the render mode, not the framework. Server-rendered (Next.js SSR, SvelteKit node) ships a container exactly like a backend service; a static export (Next.js output: 'export', Vite build) ships files to object storage behind a CDN. Pick the mode first. Read [[ci-cd-pipeline-authoring]] for the workflow naming/dispatch contract this fills in.
Core principle: Match the deploy target to the render mode, bake public config at build time, and invalidate the CDN on every deploy — a stale edge cache is the most common "I deployed but nothing changed."
Pick the target, then copy the boilerplate
search_boilerplate_catalog → deploy gcp web / deploy aws web. Copy its deploy-stage/preprod/prod.yml into .github/workflows/ as <id>-deploy-<env>.yml, then set the README's repo/environment vars. OIDC auth, no keys.
SSR (containerized)
Build the image, push it, then deploy it:
- GCP:
google-github-actions/authwith Workload Identity Federation (no key JSON), thengcloud run deploy $SERVICE --image $IMAGE --region $REGIONto Cloud Run. The revision URL is what you smoke-test. - AWS:
aws-actions/configure-aws-credentialswithrole-to-assume(OIDC), push to ECR, then deploy via ECS Express Mode (AWS's current recommended default) or ECS Fargate withaws-actions/amazon-ecs-deploy-task-definition(wait-for-service-stability: true) for more control.
Use this path when the app has server components, API routes, or ISR.
Static (object storage + CDN)
- GCP: either Firebase Hosting (
firebase deploy --only hosting, simplest, CDN + rollback built in) or a GCS bucket + Cloud CDN / load balancer; after upload, invalidate the CDN. - AWS: sync the build output to an S3 bucket and serve via CloudFront; after
aws s3 sync, runaws cloudfront create-invalidation --paths '/*'. - Set long cache TTLs on hashed assets and
no-cacheonindex.htmlso a deploy is picked up immediately. - Next.js static export is
output: 'export'innext.config(thenext exportCLI command was removed) — keep the build step producing theout/directory the sync step uploads.
Build-time env
- Public config is inlined at build time (
NEXT_PUBLIC_*,VITE_*) — it is baked into the bundle, so the build job for each environment sets that environment's values from vars. You cannot change aNEXT_PUBLIC_value after build without rebuilding. - Never put a secret in a
NEXT_PUBLIC_/VITE_var — it ships to the browser. Secrets belong to the server (SSR) or a backend, never the static bundle.
Health-check gate
End the job by fetching the deployed URL (SSR health route, or the static site's index.html) and fail on non-200 / missing marker. A failing smoke step fails the deploy — the release goes failed and the release engineer rolls it back; only finish_release moves a task to released.
Common Mistakes
- Static deploy with no CDN invalidation → users keep the old bundle.
- Aggressive caching on
index.html→ new asset hashes never get requested. - A secret in a
NEXT_PUBLIC_var, shipped to every visitor's browser. - Rebuilding per env is skipped and one bundle is promoted across envs with the wrong baked config.
- Calling the removed
next exportCLI command instead of settingoutput: 'export'.
Red Flags
- No
create-invalidation/ hosting cache bust after a static upload. - Public build vars holding tokens or keys.
- Deploy triggers on
pushfor preprod/prod instead ofworkflow_dispatch(unless the component's delivery profile is genuinelyon_merge).
04 同仓库更多 Skills
visual-craft
暂无简介
ux-copy
Use when you write any words a user reads in a mockup or a hand-off - content language and voice, buttons, labels, errors, empty states, confirmations, numbers and dates, and the longest-string check
screen-mockup-html
Use when you draw screens as the design task's HTML mockup - ONE canvas document holding every screen and every variant side by side, the sanitizer-safe recipe, phone and wide frames, the states grid, static control states, and the loopback self-check with screenshots at 375, 768 and 1440 attached to the task
performance-awareness
How the performance score moves for your role. Use when the score context shows a declining trend, or before handing off work you have not self-checked against every criterion.
design-variants
Use when a screen design needs variants - how many, variants as side-by-side rows on the one canvas, what makes two variants genuinely different, recommending one, how the human's choice is read, and narrowing to the chosen one in revision
design-system-authoring
Use when you derive, change or extend a design system - where tokens live per stack, the DTCG token tree, role-based names for both themes, base vs layer vs drift, the DESIGN.md section order, the inventory format, the contrast check and the lint every proposal returns