Skip to content

ci cd를 수정합니다. #50

ci cd를 수정합니다.

ci cd를 수정합니다. #50

Workflow file for this run

name: Node.js CI and Deploy
on:
push:
branches:
- release
workflow_dispatch:
jobs:
build-and-deploy:
strategy:
matrix:
node-version: [20.x]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: check current directory
working-directory: ./strawberry
run: |
rm -rf node_modules/.cache
- name: Install dependencies
working-directory: ./strawberry
run: npm ci
- name: insert .env file in project
working-directory: ./strawberry
run: |
echo "${{ secrets.DOT_ENV }}" > ./.env
- name: Build
working-directory: ./strawberry
run: npm run build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
audience: sts.amazonaws.com
aws-region: ${{ secrets.DEFAULT_AWS_REGION }}
- name: Deploy to S3
run: aws s3 sync ./strawberry/dist/ s3://${{ secrets.AWS_S3_BUCKET }} --delete
- name: Invalidate CloudFront
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} \
--paths /