Skip to content

Commit e6e3779

Browse files
committed
chore: Fix github CI
1 parent 4c2ab14 commit e6e3779

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

.github/workflows/deploy-frontend.yml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,34 +40,26 @@ jobs:
4040
with:
4141
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
4242
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
43-
aws-region: us-east-1
43+
aws-region: us-east-2
4444

45-
- name: Sync to S3
45+
- name: Sync to S3 (Zero-downtime deployment)
4646
run: |
47-
aws s3 sync interface/build/ s3://govscape-frontend-prod --delete \
48-
--cache-control "public, max-age=31536000, immutable" \
47+
# Step 1: Upload all new assets first (immutable files with hash)
48+
# These have hash in filename, so won't conflict with old versions
49+
aws s3 sync interface/build/ s3://govscape-frontend-prod \
4950
--exclude "index.html" \
5051
--exclude "_app/version.json"
5152
52-
# Upload index.html with no-cache
53-
aws s3 cp interface/build/index.html s3://govscape-frontend-prod/index.html \
54-
--cache-control "no-cache, no-store, must-revalidate" \
55-
--metadata-directive REPLACE
53+
# Step 2: Upload index.html LAST (entry point)
54+
# This ensures all referenced assets are already available
55+
# Cache headers are controlled by CloudFront policies
56+
aws s3 cp interface/build/index.html s3://govscape-frontend-prod/index.html
5657
57-
# Upload version.json with no-cache
58-
aws s3 cp interface/build/_app/version.json s3://govscape-frontend-prod/_app/version.json \
59-
--cache-control "no-cache, no-store, must-revalidate" \
60-
--metadata-directive REPLACE
61-
62-
- name: Invalidate CloudFront cache
63-
run: |
64-
aws cloudfront create-invalidation \
65-
--distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \
66-
--paths "/index.html" "/_app/version.json"
58+
# Step 3: Upload version.json
59+
# This is unecessary for statically built SvelteKit apps (consider removing later)
60+
aws s3 cp interface/build/_app/version.json s3://govscape-frontend-prod/_app/version.json
6761
6862
- name: Deployment summary
6963
run: |
7064
echo "Frontend deployed successfully to S3!"
7165
echo "Bucket: s3://govscape-frontend-prod"
72-
echo "CloudFront cache invalidated"
73-

0 commit comments

Comments
 (0)