Skip to content

Commit

Permalink
feat: github actions 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
JunJongHun committed Apr 20, 2024
1 parent 6275fde commit 780f774
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Execute CodeBuild

on:
push:
branches: [main]

jobs:
buildAndTest:
name: GithubAction
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- name: Checkout
uses: actions/checkout@v2

- name: AWS 설정
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: CodeBuild 실행
uses: aws-actions/[email protected]
with:
project-name: ${{ secrets.AWS_CODEBUILD_PROJECT_NAME }}
23 changes: 23 additions & 0 deletions buildspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 0.2
phases:
pre_build:
commands:
- echo Installing source NPM dependencies...
- npm install
build:
commands:
- echo Build started on 'date'
- npm run build
post_build:
commands:
# copy the contents of /build to S3
- aws s3 cp --recursive ./build s3://arooo-vite-react-deploy-s3-bucket/
# set the cache-control headers for index.html to prevent
# browser caching
- aws s3 cp --cache-control="max-age=0, no-cache, no-store, must-revalidate" ./build/index.html s3://arooo-vite-react-deploy-s3-bucket/
# Invalidate the CloudFront cache
- aws cloudfront create-invalidation --distribution-id E33PEHWJIFQF6A --paths /*
artifacts:
files:
- 'build/*'
- 'build/**/*'

0 comments on commit 780f774

Please sign in to comment.