Skip to content

Commit 1275e2c

Browse files
authored
Merge pull request #57 from f-lab-edu/refactoring
S3 배포 스크립트 최적화 및 비밀 변수 사용 개선
2 parents 1a78f05 + 0d446b9 commit 1275e2c

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

.github/workflows/deploy-optimized.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,43 +62,39 @@ jobs:
6262
aws-region: ${{ env.AWS_REGION }}
6363

6464
- name: Deploy to S3 with optimized settings
65-
env:
66-
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}
6765
run: |
6866
# HTML 파일 업로드 - 캐시 비활성화
69-
aws s3 sync ${{ env.BUILD_DIR }} s3://$S3_BUCKET_NAME \
67+
aws s3 sync ${{ env.BUILD_DIR }} s3://${{ secrets.S3_BUCKET_NAME }} \
7068
--exclude "*" \
7169
--include "*.html" \
7270
--cache-control "max-age=0,must-revalidate,public" \
7371
--content-type "text/html; charset=utf-8" \
7472
--delete
7573
7674
# CSS 파일 업로드 - 1년 캐시
77-
aws s3 sync ${{ env.BUILD_DIR }} s3://$S3_BUCKET_NAME \
75+
aws s3 sync ${{ env.BUILD_DIR }} s3://${{ secrets.S3_BUCKET_NAME }} \
7876
--exclude "*" \
7977
--include "*.css" \
8078
--cache-control "max-age=31536000,public" \
8179
--content-type "text/css; charset=utf-8"
8280
8381
# JS 파일 업로드 - 1년 캐시
84-
aws s3 sync ${{ env.BUILD_DIR }} s3://$S3_BUCKET_NAME \
82+
aws s3 sync ${{ env.BUILD_DIR }} s3://${{ secrets.S3_BUCKET_NAME }} \
8583
--exclude "*" \
8684
--include "*.js" \
8785
--cache-control "max-age=31536000,public" \
8886
--content-type "application/javascript; charset=utf-8"
8987
9088
# 기타 파일들 (이미지, 폰트 등) 업로드 - 1년 캐시
91-
aws s3 sync ${{ env.BUILD_DIR }} s3://$S3_BUCKET_NAME \
89+
aws s3 sync ${{ env.BUILD_DIR }} s3://${{ secrets.S3_BUCKET_NAME }} \
9290
--exclude "*.html" \
9391
--exclude "*.css" \
9492
--exclude "*.js" \
9593
--cache-control "max-age=31536000,public"
9694
9795
- name: Invalidate CloudFront
98-
if: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID != '' }}
99-
env:
100-
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
96+
if: secrets.CLOUDFRONT_DISTRIBUTION_ID
10197
run: |
10298
aws cloudfront create-invalidation \
103-
--distribution-id $CLOUDFRONT_DISTRIBUTION_ID \
99+
--distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \
104100
--paths "/*.html" "/*.css" "/*.js"

0 commit comments

Comments
 (0)