Skip to content

Commit

Permalink
feat: CD
Browse files Browse the repository at this point in the history
  • Loading branch information
jikwan0327 committed Jul 11, 2023
1 parent 4708b8f commit 7c895c6
Show file tree
Hide file tree
Showing 5 changed files with 1,241 additions and 1,089 deletions.
File renamed without changes.
63 changes: 63 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: entry-main-cd

on:
push:
branches:
- main

jobs:
deploy:
name: Build, Deploy to S3 bucket
runs-on: [ubuntu-latest]

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Generate Environment Variables File for Production
env:
REACT_APP_BASE_URL: ${{ secrets.REACT_APP_BASE_URL }}
run: |
echo "REACT_APP_BASE_URL=$REACT_APP_BASE_URL" >> .env
- name: yarn install
run: yarn install

- name: Build
run: DISABLE_ESLINT_PLUGIN=true yarn build

- name: Cache node modulesa
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: Deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
aws s3 cp \
--recursive \
--region ap-northeast-2 \
dist s3://www.entrydsm.hs.kr
- name: Configure AWS credentials
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: CloudFront Cache invalidation
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_ID }} --paths "/*"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@emotion/css": "^11.10.5",
"@emotion/react": "^11.11.0",
"@emotion/styled": "^11.10.5",
"@team-entry/design_system": "^1.0.79",
"@team-entry/design_system": "^1.0.91",
"@types/react-responsive": "^8.0.5",
"axios": "^1.2.2",
"dotenv": "^16.0.3",
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
},
output: {
filename: 'bundle.min.js',
path: path.resolve(__dirname, 'dist'),
path: path.resolve(__dirname, '../dist'),
publicPath: '/',
},
module: {
Expand Down
Loading

0 comments on commit 7c895c6

Please sign in to comment.