Skip to content

Commit

Permalink
chore: aws CI/CD를 추가한다. (#198)
Browse files Browse the repository at this point in the history
* Update main.yml

* Update main.yml
  • Loading branch information
Zero-1016 authored Jan 2, 2024
1 parent df6e8d8 commit da2984d
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,23 @@ jobs:
env:
CI: ""

- name: Deploy to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --delete
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY_ID }}
aws-region: ap-northeast-2

- name: Upload to S3
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY_ID }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SOURCE_DIR: "dist"

BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME}}
run: |
aws s3 sync \
./dist s3://$BUCKET_NAME
- name: CloudFront Invalidation
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY_ID }}
CLOUD_FRONT_ID: ${{ secrets.AWS_CLOUDFRONT_ID }}
CLOUD_FRONT_ID: ${{ secrets.AWS_CLOUDFRONT_ID}}
run: |
aws cloudfront create-invalidation \
--distribution-id $CLOUD_FRONT_ID --paths /*

0 comments on commit da2984d

Please sign in to comment.