Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
2ming00 authored Sep 5, 2024
1 parent 30cd4c2 commit 0c7e594
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy React App to S3

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install dependencies
run: npm install

- name: Build React app
run: CI=false npm run build

- name: Deploy to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ap-northeast-2
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}
run: |
aws s3 sync build/ s3://$S3_BUCKET_NAME --delete
aws s3 cp build/index.html s3://$S3_BUCKET_NAME/index.html --cache-control no-store

0 comments on commit 0c7e594

Please sign in to comment.