Skip to content

Commit

Permalink
Feat: S3 배포로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
yongseong2 committed Nov 5, 2024
1 parent 207ccf8 commit cfffdb8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 47 deletions.
76 changes: 30 additions & 46 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,37 @@
# GitHub Pages에 정적 콘텐츠를 배포하기 위한 간단한 워크플로우
name: Deploy static content to Pages

name: React build
on:
# 기본 브랜치에 대한 푸시 이벤트 발생 시 실행
push:
branches: ['main']

# Actions 탭에서 수동으로 워크플로우를 실행할 수 있도록 구성
workflow_dispatch:

# GITHUB_TOKEN의 권한을 설정하여 GitHub Pages에 배포할 수 있도록 함
permissions:
contents: read
pages: write
id-token: write

# 동시에 하나의 배포만 허용하도록 구성
concurrency:
group: 'pages'
cancel-in-progress: true
push: # main Branch에서 push 이벤트가 일어났을 때만 실행
branches:
- main

jobs:
# 단순히 배포만 수행하기에 하나의 잡으로만 구성
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
- name: Checkout source code. # 레포지토리 체크아웃
uses: actions/checkout@main

- name: Cache node modules # node modules 캐싱
uses: actions/cache@v1
with:
node-version: 20
cache: 'npm'
- name: Create .env file
run: echo "VITE_API_URL=${{ secrets.VITE_API_URL }}" >> .env
- name: Install dependencies
path: node_modules # 프로젝트의 node_modules가 있는 경로로 설정
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Install Dependencies # 의존 파일 설치
run: npm ci
- name: Build
run: npm run build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# dist 디렉터리 업로드
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

- name: Build # React Build
run: npm run build # npm run build를 실행할 경로로 설정

- name: Deploy # S3에 배포하기
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 \
build s3://sumbisori-bucket
3 changes: 2 additions & 1 deletion src/api/instance.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import axios from 'axios';
import { store } from '../store';

const API_URL = import.meta.env.VITE_API_URL;
const API_URL = 'https://k1ec344612739a.user-app.krampoline.com/api';
console.log('API_URL', API_URL);
console.log('VITE_API_URL', import.meta.env.VITE_API_URL);

const instance = axios.create({
baseURL: API_URL,
Expand Down

0 comments on commit cfffdb8

Please sign in to comment.