Skip to content

Commit

Permalink
fix: 스크립트 전체 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
capDoYeonLee committed Oct 31, 2023
1 parent 269e65f commit 51b37a9
Showing 1 changed file with 57 additions and 32 deletions.
89 changes: 57 additions & 32 deletions .github/workflows/frontendCICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,64 @@ permissions:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.17.1]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: ./fe/package-lock.json

- name: build
working-directory: ./fe
run: |
npm install
npm run build
npm test
- name: Checkout source code.
uses: actions/checkout@master

- name: Upload binary to S3 bucket
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --exclude '*' --include 'index.html'
env:
AWS_S3_BUCKET: ${{ secrets.BUCKET_NAME }}

- name: S3 Deploy
run: aws s3 sync ./build s3://csr-test-1-bucket/ --acl bucket-owner-full-control # 현재 build된 폴더에 접근 후 s3 버킷인 csr-test-1-bucket에 파일 업로드
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
- name: Invalidate CloudFront Cache # 새로 리소스를 업데이트할 때 기존 캐시 무효화
uses: chetan/invalidate-cloudfront-action@master
env:
AWS_DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION_ID }}
PATHS: '/index.html'
continue-on-error: true
- name: Invalidate cache CloudFront
uses: chetan/invalidate-cloudfront-action@master
env:
DISTRIBUTION: ${{ secrets.DISTRIBUTION_ID }}
PATHS: '/index.html'
continue-on-error: true
#jobs:
# build:
#
# runs-on: ubuntu-latest
#
# strategy:
# matrix:
# node-version: [18.17.1]
# # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
#
# steps:
# - uses: actions/checkout@v3
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v3
# with:
# node-version: ${{ matrix.node-version }}
# cache: 'npm'
# cache-dependency-path: ./fe/package-lock.json
#
# - name: build
# working-directory: ./fe
# run: |
# npm install
# npm run build
# npm test
#
# - name: S3 Deploy
# run: aws s3 sync ./build s3://csr-test-1-bucket/ --acl bucket-owner-full-control # 현재 build된 폴더에 접근 후 s3 버킷인 csr-test-1-bucket에 파일 업로드
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_REGION: ${{ secrets.AWS_REGION }}
# - name: Invalidate CloudFront Cache # 새로 리소스를 업데이트할 때 기존 캐시 무효화
# uses: chetan/invalidate-cloudfront-action@master
# env:
# AWS_DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION_ID }}
# PATHS: '/index.html'
# continue-on-error: true

0 comments on commit 51b37a9

Please sign in to comment.