728x90
반응형
.github/workflow > deploy.yml 설정하기
name: Deploy to S3 and Invalidate CloudFront Cache
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Build project
run: |
echo "VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }}" >> .env
echo "VITE_API_SERVICE_KEY=${{ secrets.VITE_API_SERVICE_KEY }}" >> .env
pnpm run build
- name: Deploy to S3
uses: jakejarvis/s3-sync-action@v0.5.1
with:
args: --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.S3_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SOURCE_DIR: 'dist'
- name: Install AWS CLI
run: |
sudo apt-get update
sudo apt-get install -y awscli
- name: Invalidate CloudFront Cache
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
PATHS: "/*"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
continue-on-error: true
728x90
반응형
'AWS' 카테고리의 다른 글
AWS LVMReadIOPS (0) | 2023.05.10 |
---|