Merge pull request #107 from softeerbootcamp4th/layout #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to S3 and CloudFront | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install AWS CLI | |
run: sudo apt-get install -y awscli | |
- name: Install Dependencies | |
run: yarn install | |
working-directory: ./admin | |
- name: Build Project | |
run: yarn build | |
working-directory: ./admin | |
env: | |
VITE_API_URL: ${{ secrets.API_URL }} | |
- name: Sync S3 | |
uses: jakejarvis/[email protected] | |
with: | |
args: --acl public-read --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_ADMIN_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
SOURCE_DIR: "./admin/dist" # 빌드된 파일들이 위치한 디렉토리 | |
- name: Invalidate CloudFront Cache | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ADMIN_DISTRIBUTION_ID }} --paths "/*" | |
env: | |
AWS_REGION: "ap-northeast-2" | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |