test: LCP delay #11
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
# This is a basic workflow to help you get started with Actions | |
name: FrontEnd deploy | |
# Controls when the workflow will run | |
on: | |
push: | |
branches: ["FE/noBE"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "18" | |
- name: Check Node v | |
run: node -v | |
- name: Install dependencies | |
working-directory: ./front | |
run: npm install | |
- name: Generate build | |
working-directory: ./front | |
run: npm run build | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Upload to S3 | |
env: | |
BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }} | |
run: | | |
aws s3 sync ./front/dist s3://$BUCKET_NAME --delete | |
aws s3 sync ./front/dist s3://$BUCKET_NAME --exclude '*' --include '*.js.gz' --content-encoding 'gzip' --content-type 'application/javascript' | |
aws s3 sync ./front/dist s3://$BUCKET_NAME --exclude '*' --include '*.svg.gz' --content-encoding 'gzip' --content-type 'image/svg+xml' | |
aws s3 sync ./front/dist s3://$BUCKET_NAME --exclude '*' --include '*.ico.gz' --content-encoding 'gzip' --content-type 'image/x-icon' | |
aws s3 sync ./front/dist s3://$BUCKET_NAME --exclude '*' --include '*.ttf.gz' --content-encoding 'gzip' --content-type 'font/ttf' | |
aws s3 sync ./front/dist s3://$BUCKET_NAME --exclude '*' --include '*.woff.gz' --content-encoding 'gzip' --content-type 'font/woff' | |
aws s3 sync ./front/dist s3://$BUCKET_NAME --exclude '*' --include '*.mp3.gz' --content-encoding 'gzip' --content-type 'audio/mpeg' | |
- name: CloudFront Invalidation | |
env: | |
CLOUD_FRONT_ID: ${{ secrets.AWS_CLOUDFRONT_ID}} | |
run: | | |
aws cloudfront create-invalidation \ | |
--distribution-id $CLOUD_FRONT_ID --paths '/*' |