@@ -143,14 +143,30 @@ depends = ["env:setup"]
143143run = " ./scripts/test-services.sh --max-retries 5 --retry-delay 10"
144144
145145# =============================================================================
146- # aws: AWS tasks
146+ # aws: AWS deployment tasks
147+ #
148+ # Deployment modes are controlled via the DEPLOY_MODE environment variable:
149+ # - local: Build containers from local Dockerfiles (DEPLOY_MODE=local)
150+ # - release: Pull prebuilt images from GHCR tagged "latest" (DEPLOY_MODE=release)
151+ # - (unset): Falls back to COMMIT_SHA env var, or "latest" if not set
152+ #
153+ # DEPLOY_MODE is NOT stored in .env, so it propagates naturally through
154+ # subprocess calls. CDK's SharedProps reads DEPLOY_MODE and sets the
155+ # appropriate image tag. Services can define their own aws:deploy:local
156+ # and aws:deploy:release tasks that set DEPLOY_MODE and delegate to aws:deploy.
157+ #
158+ # To deploy a specific tagged version from the registry (e.g., a CI-built
159+ # image), set COMMIT_SHA to the desired tag and run aws:deploy directly
160+ # without setting DEPLOY_MODE. For example:
161+ # COMMIT_SHA=abc123 npx cdk deploy (from infra/aws directory)
147162# =============================================================================
148163
149164[tasks ."aws:deploy:local" ]
150165description = " Deploy to AWS (build containers locally)"
151166depends = [" env:setup" ]
167+ env = { DEPLOY_MODE = " local" }
152168run = """
153- echo "=== Deploying Stickerlandia to AWS: $ENV (COMMIT_SHA=$COMMIT_SHA ) ==="
169+ echo "=== Deploying Stickerlandia to AWS: $ENV (DEPLOY_MODE=$DEPLOY_MODE ) ==="
154170mise run //shared:aws:deploy
155171mise run //user-management:aws:deploy
156172mise run //sticker-award:aws:deploy
@@ -163,9 +179,9 @@ echo "=== Deployment complete! ==="
163179[tasks ."aws:deploy:release" ]
164180description = " Deploy to AWS using prebuilt GHCR images"
165181depends = [" env:setup" ]
166- env = { COMMIT_SHA = " latest " }
182+ env = { DEPLOY_MODE = " release " }
167183run = """
168- echo "=== Deploying Stickerlandia to AWS: $ENV (COMMIT_SHA=$COMMIT_SHA ) ==="
184+ echo "=== Deploying Stickerlandia to AWS: $ENV (DEPLOY_MODE=$DEPLOY_MODE ) ==="
169185mise run //shared:aws:deploy
170186mise run //user-management:aws:deploy
171187mise run //sticker-award:aws:deploy
0 commit comments